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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS SQL Server Management Studio 2005 - IF Condition in Criteria Pane

Status
Not open for further replies.

AZJ

Technical User
May 5, 2011
2
GB
Hi,

I would really appreciate it if someone can please help me with this query. I am relatively new at creating views using SQL Server 2005 and am having problems using an IF statement.

I wanted to be able to use the following statment in the Criteria Pane of a a View that i have created:
IIf([A]=0, Null, [A])

Thanks for you help in advance.

Regards,
AZJ
 
Try:

NullIf(A,0)

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Hi,
Thanks for your feedback. What if i want to use a different IF statement?

Such as, If [A] = 1 then "Yes" else "No" ?

Thanks.

AZJ
 
You could try using a case statement:

Case When [A] = 1 Then 'Yes' Else 'No' End

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top