SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 IIF(ISNULL to SQL
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Briceston
Yak Posting Veteran

54 Posts

Posted - 07/28/2013 :  16:54:44  Show Profile  Reply with Quote
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])

Edited by - Briceston on 07/28/2013 17:05:23

SwePeso
Patron Saint of Lost Yaks

Sweden
30114 Posts

Posted - 07/28/2013 :  17:43:15  Show Profile  Visit SwePeso's Homepage  Reply with Quote
COALESCE([dbo_factMedicalClaims].[FinancialReportRollup], 'Unclassified') AS FinancialReportRollup


Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA

Edited by - SwePeso on 07/28/2013 17:46:28
Go to Top of Page

Briceston
Yak Posting Veteran

54 Posts

Posted - 07/28/2013 :  18:49:29  Show Profile  Reply with Quote
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

547 Posts

Posted - 07/28/2013 :  19:36:56  Show Profile  Reply with Quote


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

Go to Top of Page

Briceston
Yak Posting Veteran

54 Posts

Posted - 07/29/2013 :  00:43:46  Show Profile  Reply with Quote
Thanks, you guys are awesome!

quote:
Originally posted by MuMu88



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



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 07/29/2013 :  02:09:27  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000