views:

36

answers:

1
SET @Password = (
    SELECT UserPassword,IsLocked 
    FROM [Authentication].[tblLogin] 
    WHERE UserName=@UserName)

i m trying to get both values userpassword and islocked in two variables to be used in same SP in next query. Is it possible or do i have to write two queries for this. Is it there a concept of arrays in sql server

+9  A: 

Use select instead of set:

select 
    @Password = Password
,   @IsLocked = IsLocked
,   @UserLongName = UserLongName
,   @TopSecretPin = 1234
,   @PrefersLinux = case when LastName = 'Torvalds' then 1 else 0 end
FROM [Authentication].[tblLogin] 
WHERE UserName = @UserName
Andomar