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!

I need help with "If Null"

Status
Not open for further replies.

RMasters

Programmer
Nov 14, 2000
36
0
0
GB
Hello, I have two fields in one table and I need to combine them into a single field in a second table. The problem I have is that if the first field contains a null, the second field is not placed into the combined field in table2. I could update all nulls to values but this is not practical as they are needed elsewhere in the dbase. I am told that "If Null" could work but I have no clue about it. Please could one of you SQL heroes help me out?

Cheers folks

Rick Masters
 
the format is ISNULL(value,replacement value).

this will substitute the 'value' with the 'replacement value' if value is null.

e.g.
ISNULL(Column1,0) will substitute null values in column1 with the value 0.

 
Thanks for your quick response. I tried what you suggested and I got the following error:-

Server: Msg 155, Level 15, State 1, Line 2
'Add0' is not a recognized OPTIMIZER LOCK HINTS option.

What am I doing wrong?


Rick Masters


 
Cheers Andel & yuben, I have managed to fix the problem:-

(ISNULL(Column1,0))

Many thanks for your help lads.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top