Farrel,
No worries mate.
Don't forget though: If you declare the variable within an sql string and exec it, it will generate a new spid and the variable will only have the lifespan of the new spid. It won't be useable anywhere else in your sproc - thats when you get the variable declaration error messages. The only way I have found to return a value is with the sp_executesql. (Quite open to anyone who has found other ways forward posting replies......)
Thought: Do we need to study to be the Weasel?
Steve
We need men who can dream of things that never were.