• Register
0 votes
81 views

Problem :

I was getting the following error when running a SQL
the conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I had this issue due to a silly mistake. 

For e.g.:

September 31, 2015 non existing date.

EXEC dbo.SearchByDateRange @Start = '20150901' , @End = '20150931'

So this fails and will give error message:

Error converting data type varchar to datetime.

To fix it just input a valid date:

EXEC dbo.SearchByDateRange @Start = '20150901' , @End = '20150930'

It will executes just fine and your issue will be fixed .

9 7 4
38,600 points

Related questions

0 votes
1 answer 220 views
220 views
Problem : I am getting bellow error related to datetime the conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
asked Nov 7, 2019 peterlaw 6.9k points
0 votes
1 answer 13 views
13 views
Problem: The transformation of a datetime2 data type to a datetime data type resulted in an out-of-range value.
asked Feb 23 Muneeb Saadii 130k points
0 votes
1 answer 570 views
570 views
Problem : I have the table storing starttime and endtime. I am facing below error: “Conversion failed when converting character string to smalldatetime data type.” While selecting the below query using that table. select CAST(substring(CONVERT(varchar,convert(smalldatetime,o. ... face any error. But, when I select it from a table I got the error. Can somebody help me with this?
asked Jan 20, 2020 jwilliam 3.9k points
0 votes
1 answer 14 views
14 views
Problem: select GETDATE() Returns: 2008-09-22 15:24:13.790 I want the date part, without the time part:2008-09-22 00:00:00.000
asked Feb 15 sasha 16.2k points
0 votes
1 answer 32 views
32 views
Probelm: The conversion of the varchar value overflowed an int column.
asked Feb 16 Ethan ross 2.7k points
0 votes
1 answer 1 view
1 view
Question: How can I solve the error in the following procedure? CREATE PROCEDURE cards @salesman VARCHAR(10), @RCV10 INT, @RCV09 INT, @RCV15 INT, @GPRS15 INT, @RCV20 INT, @RCV25FTT INT, @RCV25 INT, @RCV31 INT, @RCV30 INT, @RCV35 INT, @RCV50 INT, @RCV55 INT, @SIM ... /2013' gives the following error: Msg 8114, Level 16, State 5, Procedure cards, Line 0 Error converting data type varchar to datetime
asked 2 days ago Atik03 10.1k points
0 votes
1 answer 6 views
6 views
Problem: I need help in resolving this problem: Which type of join returns rows from one table that have no direct match in the other table?
asked Apr 1 rakib1 51.5k points
0 votes
1 answer 4 views
4 views
Problem: I want to store times in a database table but only need to store the hours and minutes. I know I could just use DATETIME and ignore the other components of the date, but what's the best way to do this without storing more info than I actually need?
asked Mar 17 ummesalma 25.2k points
1 vote
1 answer 216 views
216 views
Problem : I am very new to SQL. If I try to use the sp_executesq I am often facing below strange looking error: “Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.” I have spent more than two days on above error but still can not fix above sql related error. Please guide me in fixing above sql error.
asked May 12, 2020 Martin K 6.6k points