我在下面写了这个触发器。它正在生成错误COUNT(*) From
。我希望当使用此触发器将任何行插入表“用户”时,分配中当前存在的文件夹应分配给用户。
例如:我向表中添加新行Users
假设userD
。然后在此触发器的帮助下,默认情况下,像folderA, folderB, folderC
应该分配给文件夹一样userD
的文件夹。Visible
我在下面写了这个触发器,但它是 givig 错误Count(*) From
CREATE TRIGGER Trigger_Insert ON Users
FOR INSERT
AS
declare @userid int;
declare @username nvarchar(50);
declare @useremail nvarchar(50);
declare @userpassword nvarchar(50);
select @userid=i.user_id from inserted i;
select @username=i.user_name from inserted i;
select @useremail=i.user_email from inserted i;
select @userpassword=i.user_password from inserted i;
DECLARE @intFlag INT
SET @intFlag =1
WHILE (@intFlag <=COUNT(*) FROM Assignments;) // Error Here
BEGIN
insert into UAssignment_Rights(
ua_rights_id,ua_rights_name,assignment_id,user_id)
values(@userid,'Visible','','');
SET @intFlag = @intFlag + 1
PRINT 'AFTER INSERT trigger fired.'
END
GO
你能帮我解决这个问题吗?