我有以下sql语句,当写入SourceMembers
表时,guid
列的字符串'guid'写入每列。
这是下面的语法这样做,还是来自临时表SourceMembers
的问题?
SET IDENTITY_INSERT [Groups].[dbo].[%1Members] OFF
INSERT INTO SOURCEMEMBERS
([GROUPID],
[GUID])
SELECT CONVERT(INT, GROUPID),
'guid'
FROM [#SOURCEMEMBERS]
答案 0 :(得分:0)
你把guid放在单引号中,假定它是一个字符串常量。相反,你想获取guid列,因此删除guid周围的单引号。
运行此
SET IDENTITY_INSERT [Groups].[dbo].[%1Members] OFF
INSERT INTO SourceMembers ([GroupID],[guid])
SELECT CONVERT(INT, GroupID),guid FROM [#SourceMembers]