Wednesday, March 7, 2012

Can SQL Server 2000's Select statement assign multi-variables from Table?

Can SQL Server 2000's Select statement assign multi-variables from Table?
e.g. Select @.CustomerName = CustomerName, @.EffectiveDateFrom =
EffectiveDateFrom, @.EffectiveDateEnd = EffecitveDateEnd from Customer where
customercode = 'XXX'.> Can SQL Server 2000's Select statement assign multi-variables from Table?
Yes. When multiple rows are returned, only values from the last row
returned are assigned.
Hope this helps.
Dan Guzman
SQL Server MVP
"ABC" <abc@.abc.com> wrote in message
news:eWjrMTBEGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Can SQL Server 2000's Select statement assign multi-variables from Table?
> e.g. Select @.CustomerName = CustomerName, @.EffectiveDateFrom =
> EffectiveDateFrom, @.EffectiveDateEnd = EffecitveDateEnd from Customer
> where customercode = 'XXX'.
>|||Yes it can. Have you tried it and getting an error or just asking?
Andrew J. Kelly SQL MVP
"ABC" <abc@.abc.com> wrote in message
news:eWjrMTBEGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Can SQL Server 2000's Select statement assign multi-variables from Table?
> e.g. Select @.CustomerName = CustomerName, @.EffectiveDateFrom =
> EffectiveDateFrom, @.EffectiveDateEnd = EffecitveDateEnd from Customer
> where customercode = 'XXX'.
>

No comments:

Post a Comment