December 4, 2006 at 9:07 am
Here's the condensed code, and the problem part in bold - the error message is, "Incorrect syntax near 'xp_cmdshell'.
Nope, still the same error message, but this time at Line 11, here's the code as it stands: /*****************************************************************************/ /*This script is called by a Startup Stored Procedure in the Master Database */ /*to enable session state for usraspstate in the aspstate database. */ /*The startup stored procedure is called aspstate_reinstate. */ /*King David 22/06/2004. */ /*****************************************************************************/ /*************************************************************/ /*Drop & destroy the exisiting aspstate database completely. */ /*************************************************************/ IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'aspstate') DROP DATABASE [aspstate] GO /*******************************/ /*Rename the old logfiles. Edited by King JB, 4-12-2006 */ /*******************************/ declare @s-2 varchar(8000) select @s-2 = 'rename "E:\LBBSVS01\LOGS\MSSQL$LBBSQL01\Logs\aspstate_log.LDF" "E:\LBBSVS01\LOGS\MSSQL$LBBSQL01\Logs\aspstate_log(' + convert(varchar, getdate(), 112) + ').LDF"' xp_cmdshell @s-2 /****************************************************************************/ /*Create the new database, using the default model, therefore no file names */ /*required or collation required, or individual objects to be destroyed. */ /****************************************************************************/ |
December 4, 2006 at 12:16 pm
When you drop the database sql will also drop the associated file in most of the time...
You can make use xp_fileexist procedure to check file existence...
MohammedU
Microsoft SQL Server MVP
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply