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
 General SQL Server Forums
 New to SQL Server Programming
 Query Help

Author  Topic 

PeeJay2583
Starting Member

40 Posts

Posted - 2011-05-19 : 08:23:28
I am using a query to select one column from a table using if condition as there are many SNO# in the table however getting an error.
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'If'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.

Query I am using is -

select If(Left([SNo#],1)="4","4-" + Right([SNo#],5),[SNo#]) AS SNo# from Sheet2$

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-05-19 : 08:34:41
You are running this on MSSQL?

In Love... With Me!
Go to Top of Page

PeeJay2583
Starting Member

40 Posts

Posted - 2011-05-19 : 08:46:33
Yes

Mukesh Sajjan
Go to Top of Page
   

- Advertisement -