Groups | Blog | Home
all groups > sql server clients > january 2004 >

sql server clients : Concatenating fields in stored procedures or ADO.NET


Matt Leggat
1/27/2004 11:13:19 AM


Cheers steve, chr(13) does the same as vbNewLine in datacolumn
expressions though

ISNULL(Field,"") works from stored procedures so thats been pretty
useful - is that pretty costly performance wise? is there a nicer
option?

*** Sent via Developersdex http://www.developersdex.com ***
Matt
1/27/2004 12:25:42 PM
I'm trying to either use and expression based column in my dataset which
concatenates fields (this has got be a common task, name, new line, address
and post code) but have had trouble because carriage returns don't appear to
be supported, but more importantly if any of the fields contain a null the
whole expression returns null

The other option would appear to be to have SQL Server do it for me - I'm
still relatively new to SQL Server and again, if any fields are null then
the whole expression returns null

How do I get round this!!??

Thanks

Steve Thompson
1/27/2004 1:18:06 PM
[quoted text, click to view]

Ahh, NULL propogation :) Carriage return is supported, you need to use the
CHAR function to insert the proper character. A carrage return is: CHAR(13)

[quoted text, click to view]

Use the ISNULL function for each field that may return null, you can
substitute a replacement value.

Steve

Steve Thompson
1/28/2004 12:52:40 PM
[quoted text, click to view]

I've never benchmarked performance, the only other technique I could think
of would be correction of the base field data and prevention of NULLS being
entered by using constraints.

Steve

AddThis Social Bookmark Button