Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case with a SET command
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00629298
Message ID:
00629303
Views:
9
>I cant seem to get this right:
>
>set @last = select case when @d < 1 then 0 else 1 end
>-- 0 is sleep 1 is active
>
>I am doing conditional processing in the cursor from hell <g>. I need to create a flag @last and set it 0 or 1 depending on the value of @D. What am I missing?
>
>TIA
>
>__Stephen

You can use IF statement in this case.
IF @d < 0 
  set @last = 0 
ELSE 
  set @last = 1 

-- or 

Select @last = case when @d < 1 then 0 else 1 end
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform