COOLBEANS
COOLBEANS

Reputation: 757

What is the purpose of these number signs around date value type?

Can anyone explain the correct usage/requirement of using these '#' number signs. Do they simply have to surround any date type in SQL?

Thanks

SELECT * FROM Orders
OrderDate BETWEEN #07/04/1996# AND #07/09/1996#;

Upvotes: 5

Views: 6600

Answers (2)

Gordon Linoff
Gordon Linoff

Reputation: 1269773

These are the MS Access syntax for date constants.

In most other databases, you just use a string to represent a date. In my opinion, you should use one of the ISO standard formats for this (either YYYYMMDD or my preference YYYY-MM-DD). So a valid date in most databases would be '2014-01-01'. In Access, this can be written #2014-01-1#.

Upvotes: 5

Aleksandar Stojadinovic
Aleksandar Stojadinovic

Reputation: 5049

I suppose that is a vendor specific SQL modification. If I am not mistaken, that is specific for MS Access databases that the date should be delimited with a hash.

Upvotes: 1

Related Questions