Click here to Skip to main content
15,898,374 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
SQL
SELECT    *  FROM         D_BILL
WHERE     (BILL_DAT BETWEEN 24 - 09 - 2013 19 : 19 : 13 AND 24 - 09 - 2013 19 : 19 : 13)


Error near 19 please sort out the error


SQL
SELECT    *  FROM         D_BILL
WHERE     (BILL_DAT BETWEEN '24 - 09 - 2013 19 : 19 : 13' AND '24 - 09 - 2013 19 : 19 : 13')


Error cannot convert varchar to datetime


sql server 2005
Posted
Comments
[no name] 24-Sep-13 10:03am    
Is that really the correct format for a datetime in your database?
Member 10227602 24-Sep-13 10:07am    
yes
[no name] 24-Sep-13 10:07am    
Your error message suggests otherwise.
Member 10227602 24-Sep-13 10:13am    
in second condition error is =>the convertion varchar to datetime type ressulted is an out of range datetime
Member 10227602 24-Sep-13 10:15am    
in 1st error =>Incorrect syntax near '19'.

1 solution

Try:
SQL
SELECT * FROM D_BILL WHERE BILL_DAT BETWEEN '2013-09-24 19:19:13' AND '2013-09-24 19:19:14'

The quotes and spacing are important.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900