Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Implicit vs Explicit conversion
Message
De
13/06/2008 15:38:14
 
 
À
13/06/2008 14:07:34
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01323928
Message ID:
01323966
Vues:
13
>>I've discovered numerous SPs, in the system I inherited, that rely on implicit conversion of parameters.
>>
>>I've read that it is a best practice to explicitly convert these parameters, but I would like to know if there is a performance gain using explicit conversion.
>>
>>Thanks.
>
>I really didn't test it, but for me if SQL Server should do some implicit conversion that will slow the query (with 0.000000(0)1 millisecond, just because that conversion is done once when the query is compiled.
>BUT to relay on implicit conversion is not good for me. What if you pass illegal parameter?
>Check this:
>

>DECLARE @test varchar(20)
>SET @Test = '0'
>
>SELECT 1 + @Test
>
>SET @Test = '0.0'
>SELECT 1 + @Test --BOOOOOOM
>


Thanks Borislav,

Those were my thoughts too. I was just trying to decide if I should go through all 600+ SPs looking for implicit conversions, or fix them as I encounter them. I think I'll just fix them when I run into them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform