472,144 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,144 software developers and data experts.

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 1075
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
reply views Thread by Saiars | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.