469,890 Members | 2,154 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

How to upload more than one field?

If I need to upload a single value from some singular query to the local
variable it may be like this:

set @var = (select F from T where...)

Next, what to do if I need more than one?
Is it necessary to create a cursor, then open it, fetch and so on? Or may be
something like

set @var1, @var2 = (select F1, F2 from T where...)

Thank you.
Jul 20 '05 #1
2 1050
You can assign values to multiple variables using SELECT:

SELECT
@var1 = F1,
@var2 = F2
FROM T
WHERE ...

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Evgeny Gopengauz" <ev***@ucs.ru> wrote in message
news:cd**********@news.rol.ru...
If I need to upload a single value from some singular query to the local
variable it may be like this:

set @var = (select F from T where...)

Next, what to do if I need more than one?
Is it necessary to create a cursor, then open it, fetch and so on? Or may be something like

set @var1, @var2 = (select F1, F2 from T where...)

Thank you.

Jul 20 '05 #2
> You can assign values to multiple variables using SELECT:

SELECT
@var1 = F1,
@var2 = F2
FROM T
WHERE ...


Great!! Thank you!!
I'm sorry for the stupid question, just novice....
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by dave | last post: by
5 posts views Thread by George Durzi | last post: by
7 posts views Thread by xx75vulcan | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.