Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing a date to a SQL stored proc using SQLEXEC
Message
De
27/01/2006 10:49:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01090805
Message ID:
01090933
Vues:
7
My actual experience in doing this was limited & is several months behind me, but I do recall that in the transfer of dates between Fox and Sql you will need to make special consideration for empty dates on the fox side. Perhaps experiment & see how they come across & then make provisions accordingly.

Perhaps as a first step, pass some hard coded values to insure everything works correctly, and then step back to properly building the string to pass to your sproc.


>There's no need to cast, however, when you use DTOC() results can vary depending on the SET DATE TO setting and the date setting SQL Server is using, specially when working with OS and Server in different languages or with different local settings. When in need to send a date to sql server I always use DTOS() to convert dates, that way the server will transform the date to whatever setting it's using.
>
>HTH
>
>
>>I am running SQL Server 2000 and am using SQLEXEC() to pull recordsets from SQL. I want to pass two date parameters from VFP7 to SQL using SQLEXEC but I don't get any data back. Here is my syntax on the VFP side:
>>
>>nRetVal = SQLEXEC(nConn,"EXEC usp_StoredProc '"+ALLT(DTOC(dDate1))+"' '"+ALLT(DTOC(dDate2))+"'",'cursor1')
>>
>>Within my SQL sp I have a @dDate1 DATETIME, @date2 DATETIME declared.
>>
>>Do I need to somehow CAST the VFP dates to DATETIME?
Paul A. Busbey
Victoria Insurance
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform