Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 尝试使用1个查询初始化2个变量中的2个值,是否可以这样做。?_Sql_Sql Server_Sql Server 2005 - Fatal编程技术网

Sql 尝试使用1个查询初始化2个变量中的2个值,是否可以这样做。?

Sql 尝试使用1个查询初始化2个变量中的2个值,是否可以这样做。?,sql,sql-server,sql-server-2005,Sql,Sql Server,Sql Server 2005,我试图在两个变量中获取userpassword和islock这两个值,以便在下一个查询中在同一个SP中使用。是否可能,或者我必须为此编写两个查询。 sql server中是否有数组的概念使用select而不是set: SET @Password = ( SELECT UserPassword,IsLocked FROM [Authentication].[tblLogin] WHERE UserName=@UserName) 使用选择而不是设置: SET @Pass

我试图在两个变量中获取userpassword和islock这两个值,以便在下一个查询中在同一个SP中使用。是否可能,或者我必须为此编写两个查询。
sql server中是否有数组的概念

使用
select
而不是
set

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

使用
选择
而不是
设置

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