There's something wrong; either you're using 2005 or earlier, either you didn't find it yet in 2008, because it's there.
http://msdn.microsoft.com/en-us/library/bb630352.aspx -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Rafael Copquin Sent: Wednesday, May 11, 2011 9:16 PM To: [email protected] Subject: Re: transact sql Thank you Fred This works very well And also thanks to Ted Roche for his suggestion of using named parameters What I am using is a literal such as cCmd dDate = date() cCmd = 'select * from invoices where invdate= '+'{'+dtoc(dDate)+'}' nResult = SQLEXEC(nHandle, cCmd,'curInvoices') But if I use a named parameter, with the ? operator, I guess it would work as well I thought that there must be a better way but for some reason, MS built into SQL Server Express 2008 many date functions but omitted an equivalent to the VFP date() function. Why?? Rafael Copquin El 11/05/2011 14:47, Fred Taylor escribió: > True, but if you declare a local variable for T-SQL, you do get back a > date > type: > > DECLARE @dvar DATE; > SELECT @dvar=getdate(); > SELECT * FROM invoices WHERE invdate=@dvar; > > Fred > > > On Wed, May 11, 2011 at 10:44 AM, Richard Kaye<[email protected]> wrote: > >> Not exactly. The VFP date() function returns a "date" datatype. The >> SQL getdate()( function returns a "datetime" datatype. Depending on >> the version of SQL you're talking to, there is no such thing as a >> "date" datatype. To go back to Rafael's original question, he'd >> probably have to use a BETWEEN filter in his SQL as it's unlikely >> that invdate will return any matching rows when using a direct >> comparison to the current datetime down to the millisecond. >> >> -- >> rk >> >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] >> On Behalf Of Stephen Russell >> Sent: Wednesday, May 11, 2011 1:26 PM >> To: [email protected] >> Subject: Re: transact sql >> >> On Wed, May 11, 2011 at 12:07 PM, Rafael >> Copquin<[email protected]> >> wrote: >>> What is the transact sql equivalent of the date() function? >>> >>> How would you change the following vfp statement into a transact sql >>> statement? >>> >>> select * from invoices where invdate = date() >> ------------- >> >> date() = getdate() >> >> >> >> -- >> Stephen Russell >> >> Unified Health Services >> 60 Germantown Court >> Suite 220 >> Cordova, TN 38018 >> >> Telephone: 888.510.2667 >> >> 901.246-0159 cell >> [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

