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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 case error

Author  Topic 

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2004-03-04 : 11:30:21
hi,
I am trying to do something like this:

declare @a int
set @a=0
select case @a when @a=0 then 1 end as a

it gives an error
is it possible to use case statemeent for variables?

He is a fool for five minutes who asks , but who does not ask remains a fool for life!

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-03-04 : 11:33:18
Yes it is, the problem is in your syntax.

SELECT CASE @a WHEN 0 THEN 1 END AS A
OR
SELECT CASE WHEN @a = 0 THEN 1 END AS A


Raymond
Go to Top of Page

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2004-03-04 : 12:27:28
quote:
Originally posted by raymondpeacock

Yes it is, the problem is in your syntax.

SELECT CASE @a WHEN 0 THEN 1 END AS A
OR
SELECT CASE WHEN @a = 0 THEN 1 END AS A


Raymond


thanks
I am totally pissed off, its been a loooong day

He is a fool for five minutes who asks , but who does not ask remains a fool for life!
Go to Top of Page
   

- Advertisement -