Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dotosu
Starting Member
42 Posts |
Posted - 2003-08-14 : 13:05:19
|
| Hello,I want to print several columns in the query analyzer and I am using the concatenate operator for that. But when any column in NULL, PRINT statement only prints a blank line. How can I avoid that? Is there any other way to print? I am using a cursor so I do not want to use the SELECT statement because it also prints the column headings everytime.I would appreciate help.Thanks in advance. |
|
|
dsdeming
479 Posts |
Posted - 2003-08-14 : 13:15:18
|
| You can use ISNULL or COALESCE:SELECT ISNULL( ColumnA, '' )or SELECT COALESCE( ColumnA, '' )Dennis |
 |
|
|
dotosu
Starting Member
42 Posts |
Posted - 2003-08-14 : 13:36:04
|
| Thanks for the help.I used SET CONCAT_NULL_YIELDS_NULL OFFIs this also ok?Thanks |
 |
|
|
drymchaser
Aged Yak Warrior
552 Posts |
Posted - 2003-08-14 : 13:38:20
|
| I believe you can turn off column headings in QA output like SET_NOCOUNT_ON and I do not believe COALESCE will work for what you are trying to do.The ISNULL(<column_name>, '') should do fine Select ISNULL(<column1_name>, '')+ISNULL(<column2_name>, '')+ISNULL(<column3_name>, '')... |
 |
|
|
|
|
|