Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
May 31, 1999
A. This is because a variable is local to a batch of SQL - normally batches are split up with GO statements. However an EXEC is a separate batch and so it cannot see any local variables already created.
You must put the variable declarations you need inside the EXEC statement.
You May Also Like