Along with the unused variables, it would be great to have the script check if all the variable sizes are large enough to hold the results. For example given the following
Table A
(
B varchar (20)
)
Declare @bvar varchar(10)
select top 1 @bvar = B from A
It would show an error for bvar since bvar is not large enough to hold the results of column B.
Table A
(
B varchar (20)
)
Declare @bvar varchar(10)
select top 1 @bvar = B from A
It would show an error for bvar since bvar is not large enough to hold the results of column B.