SQL Date Syntax in MS Access, SQL

MS Access

In SELECT queries for Access (JET), put hash signs around the date. No quote marks.

SELECT *
FROM tblInvoices
WHERE CustomerID = 1 AND InvoiceDate > #01/01/98#

From: http://msdn.microsoft.com/en-us/library/aa140011(office.10).aspx

 

SQL Server

WHERE (Members.DateAdded < CONVERT(DATETIME, '2010-06-08 00:00:00', 102)) AND (Contacts.PhoneExt <> '11')

SELECT CONVERT(date, getdate()) - get date from a datetime field.

WHERE CONVERT(date, DateAdded) = '2019-01-21'


Tags: date, format, hash, pound, syntax, sql, msaccess, query
 

Related Scribbles:
  • MS Access - Query for Number Sign
  • MS Access Notes


  • ID: 926
    Author:
    leonard
    Date Updated:
    2019-05-23 10:50:54
    Date Created:
    2009-04-29 12:22:52

    Edit

    Comments?
     >> Leonard Chan's Homepage  >> Scribble Web  >> SQL Date Syntax in MS Access, SQL
    leonard.lotus-land.ca is hosted by Perceptus Solutions Inc.