I am trying to delete from table carCategory where the carCategory Id = @id if is set or the carCategory Id is in parameters like where id in (1,2,3)so i used where id in (@strIds)but it gives me an error "Syntax error converting the varchar value '1,2,3' to a column of data type int"and here is the codeCREATE PROCEDURE [dbo].[carCategoryDelete]( @id int = NuLl, @strIds varchar(2000) = Null) ASif @id is not NullBegin DELETE FROM carCategory WHERE Id = @idEndElseBegin declare @SQL as nvarchar(4000) SET @SQL = 'DELETE FROM carCategory' SET @SQL = @SQL + ' WHERE id in(@strIds)' EXEC SP_EXECUTESQL @SQL, N'@strIds varchar(2000)', @strIdsEndGO