Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function or Stored Procedure?
Message
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Function or Stored Procedure?
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01527340
Message ID:
01527340
Vues:
118
Hi,

This one is a truly newbie question.

I need to create either a stored procedure or a function to serve the following purpose:

In my VFP application, in Stonefield SDT, a table has a user-defined field (e.g. MyDateFunc). This function passes two field values, Date1 and Date2. So in the SDT this field/function defined as
MyDateFunc( Date1, Date2 )
This function therefore is in my application database container. Then, using SF Query, I can use this field to query the database. For example, the query could be like this:
select * from MyTable where MyDateFunc( Date1, Date2) > 3
In my VFP application there is actually this function, MyDateFunc, that takes two dates as parameters and returns the difference.

When using SQL server this fails. Obviously because SQL Server does not have function MyDateFunc.

So my question is, in order for the SQL Select to work against SQL Server, should I create a function MyDateFunc in SQL server or a Stored Procedure MyDateFunc?

TIA.
"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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform