Solved

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

Posted on 2013-02-07
6
127 Views
Last Modified: 2013-02-08
this way

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


|Thanks
Alex
0
Comment
Question by:hidrau
6 Comments
 
LVL 10

Accepted Solution

by:
bigbigpig earned 167 total points
ID: 38864862
select * from table where date_order between '07-02-2013 09:00' and '07-02-2013 09:30';
0
 
LVL 1

Author Comment

by:hidrau
ID: 38864896
I got this error
The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.
0
 
LVL 10

Expert Comment

by:bigbigpig
ID: 38864916
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);
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 167 total points
ID: 38864939
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 166 total points
ID: 38866434
The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value
Since you are using a character data type instead of datetime or smalldatetime you are going to have to:
1.  Fix all badly formatted data.
2.  When 1 is done, let us know what date format you are using.
0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 38868699
Thanks everybody
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question