Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NULL value in results
Message
 
 
À
13/06/2008 11:58:06
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01323872
Message ID:
01323885
Vues:
14
>>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform