This is working on MSSQL 2008 and up; SQL Server 2005 doesn't have a DATE datatype, so the only choice is using a BETWEEN.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Fred Taylor Sent: Wednesday, May 11, 2011 8:48 PM To: [email protected] Subject: Re: transact sql 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.

