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!

How do you write iif isnull in SQL View?

Status
Not open for further replies.

kayek

Programmer
Jun 19, 2003
95
0
0
US
The following is an Example Access Query I want to put make into an SQL View. The iif(isnull) is not working. Need help on writing the SQL Statement.

SELECT Column_A, Column_B, (iif(isnull(Column_A),0,Column_A))-(iif(isnull(Column_B),0,Column_B)) as Column_C From Table1
 
If I understand properly, then this should do the trick for you.

Code:
[COLOR=blue]SELECT[/color] Column_A, 
       Column_B, 
       [COLOR=#FF00FF]isnull[/color](Column_A, 0)-[COLOR=#FF00FF]isnull[/color](Column_B, 0) [COLOR=blue]as[/color] Column_C 
[COLOR=blue]From[/color]   Table1

With SQL Server, IsNull Is a function that accepts 2 parameters and returns a value. If the first parameter is null, then the second parameter is returned.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top