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
 IIF(ISNULL to SQL

Author  Topic 

Briceston
Yak Posting Veteran

54 Posts

Posted - 2013-07-28 : 16:54:44
How would I code below from Ms. Access to SQL? I tried ISNULL, but SQL does not like it. I assume I should be using a select case?

FinancialReportRollup:IIf(IsNull([dbo_factMedicalClaims].[FinancialReportRollup]),"Unclassified",[dbo_factMedicalClaims].[FinancialReportRollup])

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-07-28 : 17:43:15
[code]COALESCE([dbo_factMedicalClaims].[FinancialReportRollup], 'Unclassified') AS FinancialReportRollup[/code]

Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

Briceston
Yak Posting Veteran

54 Posts

Posted - 2013-07-28 : 18:49:29
Thanks, this worked for me. For educational purposes, how would I do this with a select case?
Go to Top of Page

MuMu88
Aged Yak Warrior

549 Posts

Posted - 2013-07-28 : 19:36:56
[CODE]

CASE WHEN [dbo_factMedicalClaims].[FinancialReportRollup] IS NULL THEN 'Unclassified'
ELSE [dbo_factMedicalClaims].[FinancialReportRollup] END

[/CODE]
Go to Top of Page

Briceston
Yak Posting Veteran

54 Posts

Posted - 2013-07-29 : 00:43:46
Thanks, you guys are awesome!

quote:
Originally posted by MuMu88

[CODE]

CASE WHEN [dbo_factMedicalClaims].[FinancialReportRollup] IS NULL THEN 'Unclassified'
ELSE [dbo_factMedicalClaims].[FinancialReportRollup] END

[/CODE]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-29 : 02:09:27
COALESCE and CASE...WHEN on NULL are equivalent. former is simplified way of writing it in queries

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -