MayoorPatel
Programmer
Hi there I'm trying to assign a default value to the parameter @EndDate but I keep getting this error when I execute the procedure and pass no parameter to the @endate
Msg 241, Level 16, State 1, Procedure p_GetAllCardsIssuedByOrganisation, Line 0
Conversion failed when converting datetime from character string.
Msg 241, Level 16, State 1, Procedure p_GetAllCardsIssuedByOrganisation, Line 0
Conversion failed when converting datetime from character string.
Code:
@OrganisationID int,
@StartDate datetime = '1-jan-2005',
@EndDate datetime = getDate
as
select max(v.verifierID),count(firstname), dbo.getmonth(SignUpDate),max(dbo.getmonthdate(SignUpDate)) from tblusers u
inner join dbo.GetVerifiersByOrganisation(@OrganisationID) v
on u.createdby = v.verifierID
where usertypeID=1
and dbo.getmonth(SignUpDate) between dbo.getmonth(@startdate) and dbo.getmonth(@enddate)
group by v.organisationID,dbo.getmonth(SignUpDate)
order by dbo.getmonth(SignUpDate)