I have a serious of fields like: f1, f2, f3,f4,f5,f6,f7,f8,f9,f10
The table(s) goes like this:
Id f1 f2 f3 f4 ... f10
1 apple pear pineapple orange
2 chinese english greek britan...
...
Now I want to set only one variable to get the value of these fields:
I wrote like this:
declare @.m int,f@.m nvarchar(50),i int
set @.m=1
set @.i=1
set f@.m=(select f@.m from s where id=@.i)
It seems that sql doesn't support such way of declare. What can I do?
Thanks in advance!Just a quick hint - why don't yo simply use a table data type variable?
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"treesy" <treesy@.hostran.com.cn> wrote in message
news:equEgdcsEHA.2660@.TK2MSFTNGP12.phx.gbl...
> I have a serious of fields like: f1, f2, f3,f4,f5,f6,f7,f8,f9,f10
> The table(s) goes like this:
> Id f1 f2 f3 f4 ... f10
> 1 apple pear pineapple orange
> 2 chinese english greek britan...
> ...
> Now I want to set only one variable to get the value of these fields:
> I wrote like this:
> declare @.m int,f@.m nvarchar(50),i int
> set @.m=1
> set @.i=1
> set f@.m=(select f@.m from s where id=@.i)
>
> It seems that sql doesn't support such way of declare. What can I do?
>
> Thanks in advance!
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment