Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replacing VFP Function with SQL Server
Message
 
 
À
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:
01609071
Vues:
41
>>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.

Do I understand correctly that DATEDIFF() is a "standard" SQL Function that accepts three parameters? (sorry for so many questions).
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform