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

CASE statment syntax error

Status
Not open for further replies.

robmoors

Programmer
Jan 10, 2001
24
0
0
Please tell me what's wrong with this code, I am getting a syntax error.


SELECT CASE CCur(DTSSource("Bal Prin"))

CASE < 5000
DTSDestination(&quot;BALANCE_IND&quot;) = &quot;<5K&quot;
CASE >= 5000 AND < 15000
DTSDestination(&quot;BALANCE_IND&quot;) = &quot;>5K < 15K&quot;
CASE >= 15000 AND < 30000
DTSDestination(&quot;BALANCE_IND&quot;) = &quot;>15K < 30K&quot;
CASE ELSE
DTSDestination(&quot;BALANCE_IND&quot;) = &quot;>30K&quot;
END SELECT

 
According to the BOL, I think your query should be: (replace '<col>' with the column name being compared and '<table>' with the table you are pulling from.)

SELECT CASE CCur(DTSSource(&quot;Bal Prin&quot;))

When <col> < 5000
DTSDestination(&quot;BALANCE_IND&quot;) = &quot;<5K&quot;
When <col> >= 5000 AND < 15000
DTSDestination(&quot;BALANCE_IND&quot;) = &quot;>5K < 15K&quot;
When <col> >= 15000 AND < 30000
DTSDestination(&quot;BALANCE_IND&quot;) = &quot;>15K < 30K&quot;
When <col> ELSE
DTSDestination(&quot;BALANCE_IND&quot;) = &quot;>30K&quot;
END
FROM <table>


-Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top