以下代码有效。这可以改善吗?
declare @rlcstallname varchar(50), @rlcsalesdept varchar(50), @rlcpath varchar(50)
set @rlcstallname = (select stallname from sometable)
set @rlcsalesdept = (select salesdept from sometable)
set @rlcpath = (select [path] from sometable)
我需要知道如何只使用一个select语句将我存储的三个值存入变量;我发现执行3个选择语句过多。
由于
答案 0 :(得分:7)
SELECT
@rlcstallname = stallname,
@rlcsalesdept = salesdept,
@rlcpath = [path]
FROM sometable