I´m trying to create a MSSQL tabel where after a UserRegistation (create user wizard) the UserID from "aspnet_Users (dbo)" will be copied into this new tabel. Can anyone tell me how to do this?
Thanks
I´m trying to create a MSSQL tabel where after a UserRegistation (create user wizard) the UserID from "aspnet_Users (dbo)" will be copied into this new tabel. Can anyone tell me how to do this?
Thanks
如果您想要一个对特定操作做出响应的自动化系统,TRIGGER
那么您最可能需要的是 a。
在您的情况下,听起来好像您想响应INSERT
dbo.aspnet_Users 表上发生的 s 。代码将与此类似(伪代码,未经测试):
CREATE TRIGGER trgNewUser ON dbo.aspnet_Users
AFTER INSERT
AS
INSERT INTO myTable (userID)
SELECT userID FROM INSERTED
INSERTED
是一个特殊的逻辑表,它本质上与创建触发器的表具有相同的结构,并且它将包含INSERT
表中的最新行。因此,您可以使用它来捕获新添加的记录,并让触发器采取适当的行动。
有关触发器的更多信息: