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

CONCAT_NULL_YIELDS_NULL

Status
Not open for further replies.

gd082

Programmer
Mar 12, 2002
42
BE
Hi

I have a problem setting this value. I'd like to concatinate 2 strings, but sometimes one of those 2 is empty. So I tried to set 'CONCAT_NULL_YIELDS_NULL' to False.

USE ADRES EXEC sp_dboption 'adres', 'CONCAT_NULL_YIELDS_NULL', 'False'

I used this function. SQL Server Enterprise Manager says 'Query has executed succesfully', but when I try my statements (so string1 + string2) it's not working!

In SQL Query Analyzer you can set a DB option, but it seems like that's not possible in the Enterprise manager...
 
Rather than adjusting the server settings, you might prefer to handle the condition in the code. That way it will run properly on any server, no matter what the settings (or future settings) are.

Perhaps something like this:

select @String3 = ISNULL(@String1,'') + ISNULL(@String2,'')

(Those are two single quotes, not one double quote.)

bp
 
Thanx a lot bp! I've been searching for it for hours!
So I used "SELECT ISNULL(string1,'') + ISNULL(string2,'') as kolom1".

Terry, this SET-option wasn't working either... Thx anyway :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top