Solved

CASE not working right with expression

Posted on 2008-10-29
5
189 Views
Last Modified: 2012-05-05
in my select statement, I am trying to set a value with a CASE, and its saying it doesn't like my expression '>='

It says Incorrect Syntax.

CASE INCREMENT_RANGE WHEN >= '0' THEN '1' END AS TIME_VALUE
0
Comment
Question by:chrisryhal
  • 2
  • 2
5 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 500 total points
ID: 22832912
If you're doing anything other than = in a case, it all has to go in the WHEN, not between case and when.

ex.

CASE WHEN INCREMENT_RANGE >= '0' THEN '1' END AS TIME_VALUE
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22832919
Also, you don't want quotes around integer values, unless you have them stored in a varchar field.
0
 
LVL 22

Expert Comment

by:PedroCGD
ID: 22832944
You need to add WHEN:
CASE WHEN INCREMENT_RANGE WHEN >= '0' THEN '1' END AS TIME_VALUE

Check and give feedback!
0
 
LVL 22

Expert Comment

by:PedroCGD
ID: 22832949
You need to add WHEN:
CASE WHEN INCREMENT_RANGE >= '0' THEN '1' END AS TIME_VALUE

Check and give feedback!
0
 
LVL 2

Author Closing Comment

by:chrisryhal
ID: 31511260
Thanks!!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question