Results 1 to 2 of 2
Oct 15, 2004, 06:06 #1
- Join Date
- Apr 2002
- London, England
- 0 Post(s)
- 0 Thread(s)
sql SELECT query problem, using dates
Can anyone help me? This thing is driving me up the wall!
I spent all yesterday afternoon working out how to create a new user in Microsoft SQL (use stored procedure "sp_adduser" for anyone who finds themselves in this situation!) then, when I logged in as this new user, the damned thing started giving me grief executing a SELECT query using dates...
I am trying to execute this query:
SELECT * FROM meetings WHERE [date] > '15/09/2004 15:00:07' AND [date] < '15/11/2004 15:00:07';
Microsoft OLE DB Provider for SQL Server error '80040e07' The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
So, I tried removing the apostrophes:
SELECT * FROM meetings WHERE [date] > 15/09/2004 15:03:06 AND [date] < 15/11/2004 15:03:06;
.. and got the following error:
Microsoft OLE DB Provider for SQL Server error '80040e14' Line 1: Incorrect syntax near '15'.
WHAT IS GOING ON ??!
the column [date] is formatted as datetime
I'm using Microsoft SQL Server v8.
If anyone has any ideas, I would be really grateful for some help. This thing has been driving me mad!!
Last edited by willmoss; Oct 15, 2004 at 06:09. Reason: changed title of thread
Oct 15, 2004, 06:31 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 49 Post(s)
- 1 Thread(s)