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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAST and CASE

Status
Not open for further replies.

Rbar

Programmer
Jun 25, 2001
18
US
I want to cast the output of a case statement, but I havne't been able to get the syntax correct.

cast(case when abckey like 'star%' then abckey else '' end as char(5)) as as STATUS
3706: Syntax error: expected something between '(' and the 'case' keyword.

 
Try this.

cast((case when abckey like 'star%' then abckey else '' end) as char(5)) as STATUS
 

It turns out I was missing the comma to separaate SELECT statements.
Your syntax is perfect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top