Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CASE Statement in t-SQL

Status
Not open for further replies.
Aug 22, 2011
13
US
Hi ,

I have an Access SQL as this:

SELECT IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First Name]),IIf(IsNull([First Name]),[Last Name],[Last Name] & ", " & [First Name])) AS [File As]

Which i converted to A CASE statement in SQL:

SELECT CASE WHEN IsNull([Last Name, 0]) THEN CASE WHEN IsNull([First Name,0])THEN [Company] ELSE [First Name] END ELSE CASE WHEN IsNull([First Name,0])THEN [Last Name] ELSE [Last Name] & [,] & [First Name] END END AS [File As]
FROM dbo.Contacts

And it keeps giving error "the isnull function requires two arguments". Can someone please help me with this, what is the mistake that i have
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top