If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > How to display blank?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Mar 2003
Posts: 223
How to display blank?

Hello, everyone:

By default, SQL Server display "NULL" if there is no data value. How to display blank instead of "NULL"? Thanks a lot.

ZYT
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Nov 2003
Posts: 94
Assuming the [value] to be a character type:

ISNULL( [VALUE], '' )

You may have to cast non-chars to be chars. 'Blank' can never be a valid numeric but

ISNULL( [VALUE], 0 )

may hit the spot.
Reply With Quote
  #3 (permalink)  
Old
Just DBA
 
Join Date: Jul 2002
Location: Village, MD
Posts: 621
COALESCE
Returns the first nonnull expression among its arguments.

Syntax
COALESCE ( expression [ ,...n ] )
Reply With Quote
  #4 (permalink)  
Old
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 12,560
Simple solutions, but this is a formatting issue that is best left to your interface to handle. Both of these solutions display correctly by changing the actual value returned from a NULL to an empty string. NULLs and zero-length strings are very different data values, and may be interpreted differently by whatever reporting interface is receiving the result set.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
www.LobsterShot.blogspot.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On