请问能否用一个SQL查询出多个值,然后将不同的值赋给不同的变量?
请问能否用一个SQL查询出多个值,然后将不同的值赋给不同的变量?
例如:
DECLARE @UserID NVARCHAR(50),
@AreaName NVARCHAR(50),
@RoleName NVARCHAR(50)
SELECT @AreaName=AreaName, @RoleName=RoleName, EmpName FROM EmployeeInfo WHERE EmpID = @UserID
DECLARE @UserID NVARCHAR(50),
@AreaName NVARCHAR(50),
@RoleName NVARCHAR(50)
SELECT @AreaName=AreaName, @RoleName=RoleName, EmpName FROM EmployeeInfo WHERE EmpID = @UserID