Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP DATE() vs. SQL GETDATE()
Message
From
21/04/2006 08:53:42
 
 
To
21/04/2006 08:48:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows NT
Database:
MS SQL Server
Miscellaneous
Thread ID:
01115333
Message ID:
01115336
Views:
13
>In VFP it's easy to reference the last month of data by using DATE()-31 but when I try this with SQL (ver. 6.5) GETDATE()-31, I get an error.
>
>How can you use MS SQL's GETDATE() and subtract (or add) a specific number of days?


In T-SQL you have the DATEADD(datepart,number,date) function instead.

Params:
datepart would be day (dd)
number would be 31
date would be GETDATE()


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform