0

例如,我正在尝试这样做:

INSERT INTO 
   [LNK_54SD_Reporting].[54_SD_Membership].[Users] (ApplicationId, UserId, UserName, IsAnonymous, LastActivityDate) 
VALUES 
   (@ApplicationId, @UserGuid, [inserted].[email], 0, 0)

但我得到了inserted.email无法绑定的错误。

根据建议,我也试过这个:

INSERT INTO 
    [LNK_54SD_Reporting].[54_SD_Membership].[Users] 
    (SELECT 
         ApplicationId, UserId, UserName, IsAnonymous, LastActivityDate) 
VALUES  
    (@ApplicationId, @UserGuid, i.[email], 0, 0 FROM INSERTED)

这给了我一个 SELECT 错误

当我也尝试插入其他数据时,从插入触发器上的插入行获取数据的属性语法是什么?

4

1 回答 1

2

根据您的信息...

 INSERT INTO [LNK_54SD_Reporting].[54_SD_Membership].[Users] 
 (ApplicationId, UserId, UserName, IsAnonymous, LastActivityDate) 
 SELECT @ApplicationId, @UserId, inserted.email, 0, 0
 FROM INSERTED

虽然也许 LastActivityDate 应该是Null

于 2012-09-13T19:50:06.167 回答