Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2008-08-15 : 08:01:15
|
| i have a query like thisSelect Col1,Col2,Col3 from MyTable where Col1=1which gives me a single row.I have been using this query in my SP and just want to store all these values in individual Variable (with in that SP).Can any one help me in this regard? |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-08-15 : 08:19:50
|
| how do you want to use this variable once you have it? You could use a table variable, or xml, or a csv string...Be One with the OptimizerTG |
 |
|
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2008-08-15 : 08:22:47
|
| Actually I have 3 variables var1,var2,var3and I have a querySelect Col1,Col2,Col3 from MyTable where Col1=1I just want to have values like var1= Col1 ,var2=Col2,var3=Col3 |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-08-15 : 08:24:26
|
| select @var1 = col1, @var2 = col2, @var3 = col3from MyTable where Col1=1Em |
 |
|
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2008-08-15 : 08:31:57
|
| Thank You, You solved my problem |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-15 : 11:54:58
|
| Are you sure you'll be having single record returned satisfying the above condition? ELse you need to use a table varaible as suggested earlier. |
 |
|
|
|
|
|
|
|