Abdul Khan
asked on
Conversion failed when converting the varchar value
Getting Conversion error when using the following code.
Declare @BeginDate datetime
Declare @EndDate datetime
Set @BeginDate = '03/01/2018'
Set @EndDate = '03/31/2018'
Select Count(AA.OrderD), BB.Age
from Livedb.dbo.AccountMain AA
left join Livedb.dbo.Sales_Main BB
on AA.OrderID.PatientID=BB.Or derID
where isnull(AA.DateTime1,AA.Dat eTime2) between @BeginDate and @EndDate
group by BB.Age
Having BB.Age > 17
Getting the following error when I use HAVING clause (it works without) :
Conversion failed when converting the varchar value '0m 17d' to data type int.
Declare @BeginDate datetime
Declare @EndDate datetime
Set @BeginDate = '03/01/2018'
Set @EndDate = '03/31/2018'
Select Count(AA.OrderD), BB.Age
from Livedb.dbo.AccountMain AA
left join Livedb.dbo.Sales_Main BB
on AA.OrderID.PatientID=BB.Or
where isnull(AA.DateTime1,AA.Dat
group by BB.Age
Having BB.Age > 17
Getting the following error when I use HAVING clause (it works without) :
Conversion failed when converting the varchar value '0m 17d' to data type int.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER