By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,575 Members | 1,968 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,575 IT Pros & Developers. It's quick & easy.

Help on the following SQL server Select query

P: 14
SELECT *
FROM jake19812ce655..FIREFOX_Memory
WHERE Date >= 2008-08-27 04:33:00
AND Date <= 2008-08-27 04:34:23


hi ..when running the above given query I am getting an error message that says
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near ':'.

I dont understand what's wrong as the date column in FIREFOX has valid
rows with date/time values in them
Aug 28 '08 #1
Share this Question
Share on Google+
2 Replies


ck9663
Expert 2.5K+
P: 2,878
SELECT *
FROM jake19812ce655..FIREFOX_Memory
WHERE Date >= 2008-08-27 04:33:00
AND Date <= 2008-08-27 04:34:23


hi ..when running the above given query I am getting an error message that says
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near ':'.

I dont understand what's wrong as the date column in FIREFOX has valid
rows with date/time values in them
Expand|Select|Wrap|Line Numbers
  1. WHERE Date >= cast('2008-08-27 04:33:00' as datetime)
That is if your Date column is of datetime data type

--- CK
Aug 28 '08 #2

P: 3
Expand|Select|Wrap|Line Numbers
  1.  
  2. select startdate from fortest;
  3. --startdate is a datetime type
  4. --the following are startdate's records in  table fortest
  5. startdate
  6. 2008-08-08 12:12:12.000
  7. 2008-08-21 21:21:21.000
  8. 2006-07-07 00:00:00.000
  9. 2009-09-09 00:00:00.000
  10. 2008-08-08 12:12:12.000
  11.  
  12. select startdate from fortest where startdate <'2009-09-09 10:00:00.000' and startdate>'2006-07-07 00:00:00.000'
  13. --now result
  14. startdate
  15. 2008-08-08 12:12:12.000
  16. 2008-08-21 21:21:21.000
  17. 2009-09-09 00:00:00.000
  18. 2008-08-08 12:12:12.000
Aug 29 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.