Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replacing VFP Function with SQL Server
Message
De
09/10/2014 13:19:15
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2014
Application:
Web
Divers
Thread ID:
01609065
Message ID:
01609070
Vues:
53
>select * from MyTable where DAYSTOCOMPLETE( DATE_CLOS, DATE_OPEN)>23)
>
>Where DATE_CLOS and DATE_OPEN are two column names of the table. Should this code work or I have to change the syntax?


First, I'd recommend always referencing the schema..... WHERE dbo.DaysToComplete....

Second, performance will be better if you do it inline....

WHERE DATEDIFF(D, OpenDate, CloseDate) > 23

I'm not a fan of scalar functions in SQL, because you can get really bad performance sometimes. Unless the benefit of a function is much higher than performance, it's better to use it inline.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform