我爲Organization
表創建插入查詢。在SQL Server中創建帶有空值的插入查詢
select 'Insert into Organizations(Name, IndustryId, ContactPerson, Email, Website, LocationId, ContactNumber, Mobilenumber) values(''' +
IsNull(Nameofthecompany, 'NULL') + ''',' +
Isnull(IndustryType, 'NULL') + ',''' +
Isnull(Nameofthepersonresponsibleforrecruitment, 'NULL') + ''', ''' +
Isnull(EmailId, 'NULL') + ''', ''' +
Isnull(websiteaddress, 'NULL') + ''',' +
Isnull(Location, 'NULL') + ',' +
Isnull(PhoneNumber, 'NULL') + ',' +
Isnull(MobileNumber, 'NULL') + ')'
from Organization
這裏我有結果集
Insert into Organizations(Name, IndustryId, ContactPerson, Email, Website, LocationId, ContactNumber, Mobilenumber)
values('username', industry, 'Name', 'NULL', 'NULL', place, NULL, 999999999)
我不想引號中的NULL值。如果我刪除引號意味着我得到錯誤。請幫助我找出問題所在。
什麼是錯誤?也許這些列不是空的! – 2013-04-10 04:57:41
那麼,你想要什麼**而不是「NULL」?只需將它們替換爲你想添加的內容..... – 2013-04-10 05:00:30
向我顯示你的列定義。如果您的列'allow Null' – 2013-04-10 05:01:39