Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Use of Greater Than In Case Statement

Author  Topic 

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2011-08-08 : 13:13:54
Can someone please tell me why I am getting an "Incorrect Syntax" error on my greater than character? I am using SQL 2008.

insert into #TEMPTABLE(col1, col2)
select GETDATE(),
TEST =
case TESTCOUNT
when TESTCOUNT > 0 then 'TRUE'
else 'FALSE'
end
FROM MYTABLE


TESTCOUNT is defined as an int, TEST is defined as a nchar(5).

Thanks

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2011-08-08 : 13:18:44
Forget it...

insert into #TEMPTABLE(col1, col2)
select GETDATE(),
TEST =
case
when TESTCOUNT > 0 then 'TRUE'
else 'FALSE'
end
FROM MYTABLE
Go to Top of Page
   

- Advertisement -