In MSSQL IF ELSE is not supported inside the SQL-Query.
For a similiar behaviour you should use CASE WHEN keyword.
Sample Query
SELECT CASE WHEN [Productnumber] LIKE '112%' THEN 'SOFTWARE' WHEN [Productnumber] LIKE '005%' THEN 'HARDWARE' ELSE 'MISC' END as [ProductType] FROM dbo.[Products]
RT @CodeSnippetsNET: How to use IF ELSE in an #SQL Select query http://t.co/sIZxReylgs #mssql #tsql #sqlserver #sequelserver #codesnippets …
RT @CodeSnippetsNET: How to use IF ELSE in an #SQL Select query http://t.co/sIZxReylgs #mssql #tsql #sqlserver #sequelserver #codesnippets …
RT @CodeSnippetsNET: How to use IF ELSE in an #SQL Select query http://t.co/sIZxReylgs #mssql #tsql #sqlserver #sequelserver #codesnippets …
RT @CodeSnippetsNET: How to use IF ELSE in an #SQL Select query http://t.co/sIZxReylgs #mssql #tsql #sqlserver #sequelserver #codesnippets …
RT @CodeSnippetsNET: How to use IF ELSE in an #SQL Select query http://t.co/sIZxReylgs #mssql #tsql #sqlserver #sequelserver #codesnippets …