Nice tip. I see Grigore says this will only work with SQL 2008 and later though.

I still think you have to cast invdate for an = comparison to return something? 
Of course, we're working with a bunch of assumptions about what invdate is in 
Rafael's example.

--
rk

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Fred Taylor
Sent: Wednesday, May 11, 2011 1: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
> 


_______________________________________________
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/DF1EEF11E586A64FB54A97F22A8BD0441924151742@ACKBWDDQH1.artfact.local
** 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.

Reply via email to