Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NULL value in results
Message
 
 
To
13/06/2008 11:58:06
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01323872
Message ID:
01323885
Views:
11
>>>Select:
>>>
>>>
>>>	QUOTENAME (ISNULL(InsCompanyID2,''),'"') AS InsCompanyID2,
>>>
>>>
>>>The result for this column is NULL, I need it to be "".
>>
>>Use another SQL Server function ISNULL or COALESCE.
>
>
>Why?
>(BTW I like COALESCE() more because that function get higher type and convert everything to it) but ISNULL should work:
>
>DECLARE @test varchar(20)
>SET @test = NULL
>
>SELECT QUOTENAME(ISNULL(@Test,''),'"') AS InsCompanyID2
>
I used ISNULL in my answer too (I embed the answer inside, may be you didn't notice). I just wanted to list both functions in my answer for the reference.

BTW, on the SQL Server interview I was asked about the difference between these two functions and since I didn't use SQL Server that much I was unable to answer (if, of course, you don't consider "I can always check the details in BOL" as an answer ) :)
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform