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 2000 Forums
 Transact-SQL (2000)
 Problem with Case Syntax

Author  Topic 

SunnyDee
Yak Posting Veteran

79 Posts

Posted - 2005-05-16 : 10:30:45
Hello: I'm trying to select items where chrRPrecision's first left character is a B, but I keep getting syntax errors. Can someone please tell me what I am doing wrong?

Thanks


[code]CASE WHEN left(tbl_RCode.chrRPrecision,1)='B'THEN
min(left(Convert(char(10),tbl_RCode.dteExportTimeStamp,101),12))
As BulkDate ELSE END[end code]

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-05-16 : 10:36:38
CASE WHEN left(tbl_RCode.chrRPrecision,1)='B'THEN
min(left(Convert(char(10),tbl_RCode.dteExportTimeStamp,101),12))
As BulkDate ELSE ???? END As BulkDate

There's no ELSE defined in your CASE statement, so leave it out or explicitly indicate ELSE NULL.

Though if you are using that funky left/convert formula to get part of a date, I recommend you use the DatePart() function instead ...

- Jeff
Go to Top of Page

SunnyDee
Yak Posting Veteran

79 Posts

Posted - 2005-05-16 : 10:51:50
Thank you for your response. I'm new to TSQL and appreciate your help.
Go to Top of Page
   

- Advertisement -