01-16-2009 03:50 AM
Hello there,
I'm using the ACTOLEDB connection to pull data through to an Excel worksheet & having a bit of trouble excluding records before a given date.
I'm using the following SQL:
SELECT tbl1.[HISTORY Created On], tbl1.[HISTORY Record Manager], tbl1.[HISTORY TYPES Name]
FROM actDb.dbo.VRP_CONTACT_HISTORY
AS tbl1
WHERE [HISTORY Created On] > 31/12/2007
Unfortunately this seems to still bring back ALL records, even those before 31/12
I thought the date value would need to be enclosed in hashes, e.g. > #31/12/2007# but get the following message:
Incorrect syntax near '#'.
Hope someone can advise?
Rgds
Burt
01-16-2009 04:39 AM
As so often is the case, had a quick smoke away from the screen and the clarity of mind returned!
Dawned on me that I should have been putting the numeric equivalent of the date value in, i.e.
31/12/2007 = 39447
Anyways, thought it best to post to save anyone replying...
Rgds
Burt
07-16-2009 11:58 AM
The condition: [HISTORY Created On] > 31/12/2007
should use a literal constant:
[HISTORY Created On] > '31/12/2007'
(single quotes added around date)