如何将用户ID为123的用户的Roles表中的ID值插入Security_UserRoles表?
INSERT INTO [Security_UserRoles]
([UserID]
,[RoleID]
,[CreatedBy]
,[CreatedOn])
VALUES
(123
,SELECT [id] FROM [Security_Roles]
,'rrr.rrr'
,GETDATE())
GO
答案 0 :(得分:1)
INSERT INTO [Security_UserRoles]
([UserID]
,[RoleID]
,[CreatedBy]
,[CreatedOn])
SELECT 123, [id], 'rrr.rrr', getdate() FROM [Security_Roles]