我正在尝试在表Class Rights中插入新行。当我执行此代码并查看表时,它不存在/未进行任何更改。为什么是这样?它是否与播种有关,或者可能没有正确声明某些内容。
DECLARE @ID INT;
IF NOT EXISTS ( SELECT 1 FROM dbo.ClassRights WHERE FKClassID = 2100000000 )
BEGIN
INSERT INTO dbo.ClassRights (FKCategoryID, FKClassID, FKRightsID)
SELECT 77, 2100000000, 4029
FROM dbo.ClassRights
END
IF EXISTS (SELECT * from ClassRights)
BEGIN
SELECT TOP 1 @ID = ClassRightsID FROM ClassRights WHERE ClassRightsID < 1000000000 ORDER BY ClassRightsID DESC
SET @ID = @ID + 1
DBCC CHECKIDENT(ClassRights, RESEED, @ID)
END