只能在使用列列表和IDENTITY_INSERT时指定 [英] Can only be specified when a column list is used and IDENTITY_INSERT
问题描述
只能在使用列列表且IDENTITY_INSERT为ON时指定
什么我试过了:
我试过以下查询
SET IDENTITY_INSERT StudentSubjectRegistration ON
GO
插入StudentSubjectRegistration
SELECT StudentSubjectRegistrationID,StudentSemesterRegistrationID,StudentRegCode,DivisionID,SemesterActivationID,SemesterID,BranchesSubjectDetailID,
SubjectDetailsID,SubjectCategoryID,SubjectGroupPID,NoOfAttempt,StudentStatusPID,ParentSubject,SubjectCode,FacultySubjectMappingID,OrgGrade,
OrgGradePoint,TotalMark,IsReExamRegistered,IsAllowReExam,IsEquivalence,IsMedicalReason,AwardedGrade,AwardedGradePoint,SubjectCredit,
EvalutionTypePID,CreditGradePoint,IsFeedBackSubmitted,YearID,CollegeID ,IsEnabled,IsAccepted,IsAccRejected,AccComment,IsApproved,IsAppRejected,
AppComment,IsFreezed,IsArchived,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn
来自OEPIS.dbo.StudentSubjectRegistration
WHERE(StudentRegCode = 111615003)AND(SemesterActivationID = 239)AND(SemesterID = 190)AND(YearID = 12)AND(SubjectCode IN('CSE-16005'))
Go
SET IDENTITY_INSERT StudentSubjectRegistration关闭
GO
但仍显示错误在sql中
只有在使用列列表并且IDENTITY_INSERT为ON时,才能指定表'StudentSubjectRegistration'中标识列的显式值。
所以请指导我
阅读错误信息。
只能在使用列列表和IDEN时指定TITY_INSERT为ON您没有指定列列表 - 这在任何时候都是一个非常糟糕的主意 - 因此您无法为IDENTITY列指定值。
INSERT INTO MyTable(Column1,Column2,...)......
can only be specified when a column list is used and IDENTITY_INSERT is ON
What I have tried:
I am tried following query
SET IDENTITY_INSERT StudentSubjectRegistration ON
GO
Insert Into StudentSubjectRegistration
SELECT StudentSubjectRegistrationID, StudentSemesterRegistrationID, StudentRegCode, DivisionID, SemesterActivationID, SemesterID, BranchesSubjectDetailID,
SubjectDetailsID, SubjectCategoryID, SubjectGroupPID, NoOfAttempt, StudentStatusPID, ParentSubject, SubjectCode, FacultySubjectMappingID, OrgGrade,
OrgGradePoint, TotalMark, IsReExamRegistered, IsAllowReExam, IsEquivalence, IsMedicalReason, AwardedGrade, AwardedGradePoint, SubjectCredit,
EvalutionTypePID, CreditGradePoint, IsFeedBackSubmitted, YearID, CollegeID, IsEnabled, IsAccepted, IsAccRejected, AccComment, IsApproved, IsAppRejected,
AppComment, IsFreezed, IsArchived, CreatedBy, CreatedOn, ModifiedBy, ModifiedOn
FROM OEPIS.dbo.StudentSubjectRegistration
WHERE (StudentRegCode = 111615003) AND (SemesterActivationID = 239) AND (SemesterID = 190) AND (YearID = 12) AND (SubjectCode IN ('CSE-16005'))
Go
SET IDENTITY_INSERT StudentSubjectRegistration Off
GO
But still error showing in sql
An explicit value for the identity column in table 'StudentSubjectRegistration' can only be specified when a column list is used and IDENTITY_INSERT is ON.
So please guide me
Read the error message.
can only be specified when a column list is used and IDENTITY_INSERT is ONYou don't specify a column list - which is a very bad idea at any time - so you cannot specify a value for an IDENTITY column.
INSERT INTO MyTable (Column1, Column2, ...) ...
这篇关于只能在使用列列表和IDENTITY_INSERT时指定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!