
November 22nd, 2004, 09:48 AM
|
|
Registered User
|
|
Join Date: Nov 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
assign a variable in the middle of a select statement
Just quick query that's seriously annoying me
How do I assign a variable in the middle of a select statement?
It works fine until I assign a value
the basic structure is
Declare
@Price_all INT,
Select ID, NAME,
case WHEN (TABLE1.Price is Null)
SET @Price_all = Table2.Price
else
SET @Price_all = Table1.Price
end
print Price_all
from Table1 Join (JOIN Table2 (NOLOCK) ON (TAble1.Id = Table2.Id)
any ideas ?
Thanks Dave
|