in my stored procude I set two parameters,
@FromDate datetime = null,@ToDate datetime = null,
and then write the WHERE clause of the SELECT statement like:
WHERE (a.AttendanceDate BETWEEN '+ CONVERT(DateTime,@FromDate) +' AND '+ CONVERT(DateTime, @ToDate) +' )';
when I hit F5 key then this stored procedure creates successfully.
But when I try to execute that procedure like:
EXEC @return_value = StoredSPName @FromDate = N'2002-02-12', @ToDate = N'2002-05-12',
it displayes error msg: "Conversion failed when converting date and/or time from character string.".