Avatar of tyy8
tyy8

asked on 

greater then symbol in a case staement

I am doing this:
CASE [Days Left] WHEN > 0 THEN [Days Left] ELSE 0 END AS [Days]

but I get an error saying there is a syntax error next to the '>',  even    WHEN [Days] > 0 THEN
gives the same error.
Microsoft SQL Server

Avatar of undefined
Last Comment
Sham Haque
ASKER CERTIFIED SOLUTION
Avatar of Raynard7
Raynard7

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Sham Haque
Sham Haque
Flag of United Kingdom of Great Britain and Northern Ireland image

Raynard7's solution should work for you - the reason is that the CASE statement can only evaluate expressions to TRUE or FALSE - in itself, it cannot make a comparison.

Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo