本文介绍了表中标识列的显式值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi 如何解决此错误 我的代码:
hi How Solve This Error my code :
SET IDENTITY_INSERT UserProfile ON GO INSERT INTO UserProfile SELECT up.UserId-2002, up.UserName, up.Name, up.Family, up.P_T, up.P_N, up.Reshteh, up.CodeOzviat, up.CodeParvaneh FROM UserProfile up WHERE (UserId =2336) GO SET IDENTITY_INSERT UserProfile OFF和错误:
and error :
Msg 8101, Level 16, State 1, Line 1 An explicit value for the identity column in table 'UserProfile' can only be specified when a column list is used and IDENTITY_INSERT is ON.推荐答案
您忘记在INSERT命令中指定列列表,如: You forgot to specify the columns list in your INSERT command like: SET IDENTITY_INSERT UserProfile ON GO INSERT INTO UserProfile (UserId, UserName, Name, Family, P_T, P_N, Reshteh, CodeOzviat, CodeParvaneh) SELECT up.UserId-2002, up.UserName, up.Name, up.Family, up.P_T, up.P_N, up.Reshteh, up.CodeOzviat, up.CodeParvaneh FROM UserProfile up WHERE (UserId =2336) GO SET IDENTITY_INSERT UserProfile OFF
更多推荐
表中标识列的显式值
发布评论