我为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