>I am moving code from two scripts in order to obtain a final script. The master one was running ok until last night. Now, I incorporated some code of the temporary script in it this morning. I just found that I am receiving:
>
>Must declare the scalar variable "@indexName".
>
>The declare is properly done at the top of the script. This reference works well for the first table where I have the same process for each table. But, once the script reaches the second table, I have this error. So, the DECLARE done higher in the code is now lost. What should I look for?
Are you ahve multiple batches (separated by GO) in the script? DECLARE is scopped to a batch.
--sb--