Community
Showing results for 
Search instead for 
Do you mean 
Reply

ACTOLEDB SQL String

New Member
Posts: 2
Country: United Kingdom

ACTOLEDB SQL String

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

New Member
Posts: 2
Country: United Kingdom

Re: ACTOLEDB SQL String

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

Employee
Posts: 4
Country: United States

Re: ACTOLEDB SQL String

The condition: [HISTORY Created On] > 31/12/2007

should use a literal constant:

    [HISTORY Created On] > '31/12/2007'

 

(single quotes added around date)