Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Datetime fields in MSSQL as Date in VFP
Message
De
08/12/2009 05:02:13
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01437969
Message ID:
01438015
Vues:
48
Naomi,

for reporting purposes (the qualification I presented), you can use the integer that datepart returns for the year, the integer that it returns for the month, and the integer it returns for the day of month, to display the date using the datetime function. Of course, not much is gained, as you will end up with the datetime equivalent of a date value (the stroke of midnight), and still have to convert it for display purposes.

Now, what we do in our SQL apps is use a control that displays date, and allows smart editing of that date, whether the underlying data is date, datetime, or character. The control on access returns the changed date + the original time.

Compared to either approach, both of which have pitfalls, using SQL2008 is much preferable.

Another case in which supporting the past is expensive to the developer.

Hank

>>Hi Yew,
>>
>>in addition to James' suggestion of using datepart in the query, SQL2008 does in fact have a date column type: http://www.sqlteam.com/article/using-the-date-data-type-in-sql-server-2008. Since you are using SPT, you are probably not updating the cursor (by setting the cursor properties to support buffering, etc.), so datepart ought to work for you.
>>
>>hth,
>>
>>Hank
>>
>Hank,
>
>How are you suggesting to use datepart in this query?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform