例如,我正在尝试这样做:
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
的错误当我尝试同时插入其他数据时,从插入触发器上的插入行获取数据的属性语法是什么?
答案 0 :(得分: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
?