Link to home
Start Free TrialLog in
Avatar of hidrau
hidrauFlag for Brazil

asked on

how can I make a query filtering with date and time?

this way

SELECT * FROM TABLE
WHERE DATE_ORDER >= 07-02-2013 09:00  and DATE_ORDER  <= 07-02-2013 09:30


|Thanks
Alex
ASKER CERTIFIED SOLUTION
Avatar of bigbigpig
bigbigpig

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hidrau

ASKER

I got this error
The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.
Avatar of bigbigpig
bigbigpig

Your data type of DATE_ORDER is smalldatetime?

select * from table where date_order between CAST('07-02-2013 09:00' AS smalldatetime) and CAST('07-02-2013 09:30' AS smalldatetime);
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hidrau

ASKER

Thanks everybody