I have a column in a table as ReportDate as Varchar feild. It is storing date . Now I have requirement that I need to find all the records whose reportDate is lying between two dates that I provide. For this I need to convert the ReportDate feild to datetime. I used the following stored Procedure but it is giving an excption telling "
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value."
Here is the sp:
alter PROCEDURE [dbo].[Get_DealerInsuranceReportAudit_byReportDate]
@StartDate varchar(10),
@EndDate varchar(10)
AS
BEGIN
select AuditID,DealerNumber,ReportDate,AccessDate,AccessedBy
from dbo.DealerInsuranceReportAudit
where CONVERT(datetime, ReportDate,101) between CONVERT(datetime, @StartDate,101) and CONVERT(datetime, @EndDate,101)
END
what should I do to correct It.