Below is my query and error. When I am putting VARCHAR variable and pass in INT value then I am getting error.
Query:
declare @vid VARCHAR(MAX)
set @vid= ('3,5,7')
Select (Stuff((Select ', ' + VehicleClassName
From VehicleClass_Master
where VehicleClassId in (@VID) FOR XML PATH('')),1,2,''))
Error:
Msg 245, Level 16, State 1, Line 3 Conversion failed when converting the varchar value '3,5,7' to data type int.