Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to do var substitution?
Message
From
31/01/2001 08:21:38
 
 
To
30/01/2001 18:07:19
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00470308
Message ID:
00470563
Views:
47
From within a stored procedure in master try something like this:

DECLARE @dbname sysname
DECLARE @cmd varchar(2000)
-- some magic happens so that @dbname takes on the name of a database <s>
SET @cmd = 'USE ' + @dbname + CHAR(13) + CHAR(10)
SET @cmd = @cmd + 'EXECUTE master..sp_cleanup'

Catching errors will be the difficult part. In the beginning I'd just write them to the log with xp_logevent.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform