Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CASE WHEN statement

Status
Not open for further replies.

strangeBrew12

Programmer
Apr 5, 2006
18
US
Simple question I hope.

I want to do:

CASE WHEN AcctStatus IN ('a','c','o') THEN AcctStatus ELSE NULL END.

Is this the right syntax? Can someone set me on the right path?

Thanks all

JJ
 
Yes. Actually you don't need ELSE NULL but this way code is more readable.

------
[small]<this is sig>
select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')
</this is sig>[/small]
[banghead]
 
That should be the right syntax.

For further information, check out the BOL. Use the Index tab and enter CASE.

-SQLBill

BOL=Books OnLine=Microsoft SQL Server's HELP
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine
or online at:


Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top