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)
 Convert if/else from access to tsql

Author  Topic 

mgoomba
Starting Member

10 Posts

Posted - 2006-08-24 : 13:44:04
I am migrating my MS Access db to SQL Server

One of my queries i have to following condional logic that i need to convert to TSQL. I've looked in some books and not quite been able to get the syntax to work. Anyways, this is what im working with:

iif(titlePrefix is null,'',[titlePrefix] & ' ') +
title +
iif(season is null,'',': ' & [season]) as title

Thanks for any help!!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-24 : 13:48:18
select ISNULL(titlePrefix + ' ', '') + title + ISNULL(': ' + season, '')


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-26 : 05:31:37
or use COALESCE in place of ISNULL

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -