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

Equivilent of Nz function in SQL?? 1

Status
Not open for further replies.

jgoodman00

Programmer
Jan 23, 2001
1,510
0
0
In our existing microsoft access database several queries had expressions which use this function. In converting to SQL server these have been lost. Is there an alternative?? James Goodman
 
Use IsNull. IsNull(ColName, 'NONE') will substitute 'NONE' when the column is Null. IsNull(ColName, 0) Will substitute zero for Null. Terry L. Broadbent - Salt Lake City, UT
Home of the 2002 Winter Olympics (Feb 8-24)
 
You might want to use IsNull() function

........

declare @chPre as varchar(10)
declare @int as integer


set @chPre = 't' --null
set @int = null

select Isnull(@chPRe, 'P'), isnull(@int, 0)

 
Thanks, Terry and RPredrag, I first looked to online help for answer to this and didn't find the answer, though it's probably there somewhere. Tek-Tips was second place I checked and I had your answer almost immediately. Total time from occurrence of question to me to finding answer here was about 10 minutes. I really like it when I don't waste much time on simple stuff like this; unfortunately things don't always work out this way.

-- Herb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top