sunshine (9/15/2008)
the previous statement must be terminated with a semicolon.
this message is fairly descriptive!! The USE statement and exec must be separated by a semi colon like so
SELECT @execmd = 'USE ' + @dbname + '';Exec sp_MSForEachTable 'Update Statistics ''?'' with FULLSCAN'''
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉