Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL 2000 UDFs for common VFP functions?
Message
De
15/10/2002 15:02:29
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00711104
Message ID:
00711444
Vues:
14
This message has been marked as a message which has helped to the initial question of the thread.
Dan,

>Has anyone duplicated (or failed to duplicate) common VFP functions as SQL 2000 UDFs? Looks like a good way to easy the transition of VFP views which are littered with IIF(), NVL(), etc.

See my other message for STREXTRACT sample. Note that you may have to GRANT permissions after setting these up, and that they may have to be called with the dbo. in front, although I'm not sure of all the rules regarding that.

HEre are two simple ones for TTOC and DTOS:
CREATE  FUNCTION [dbo].[TTOC]
    ( @dDate AS DateTime ) 

RETURNS varchar(10)

AS

BEGIN 

RETURN   RIGHT('0'+LTRIM(CAST(DATEPART(mm,@dDate) AS varchar(2))),2)+ '/' +
  RIGHT('0'+LTRIM(CAST(DATEPART(dd,@dDate) AS varchar(2))),2) + '/' + 
  CAST(DATEPART(yyyy,@dDate) AS varchar(4))
END 
GO
CREATE  FUNCTION [dbo].[DTOS] 
    ( @dDate AS DateTime ) 

RETURNS varchar(8)

AS

BEGIN 

RETURN CAST(DATEPART(yyyy,@dDate) AS varchar(4)) + 
  RIGHT('0'+LTRIM(CAST(DATEPART(mm,@dDate) AS varchar(2))),2)+
  RIGHT('0'+LTRIM(CAST(DATEPART(dd,@dDate) AS varchar(2))),2)
END 
GO
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform