Click here to Skip to main content
15,890,438 members
Articles / Database Development / SQL Server
Alternative
Tip/Trick

Keeping a Database Server Healthy

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
12 Apr 2011CPOL 3.6K   1  
Actually, we think xp_cmdshell is not safe enough, and need to be enabled using surface area configuration explicitly (SQL 2005). We use xp_delete_file instead, sample code:DECLARE @l_Runtime DATETIME, @l_BackupFileName VARCHAR(256), @l_FileExists INTSET...
Actually, we think xp_cmdshell is not safe enough, and need to be enabled using surface area configuration explicitly (SQL 2005). We use xp_delete_file instead, sample code:
SQL
DECLARE @l_Runtime        DATETIME,
        @l_BackupFileName VARCHAR(256),
        @l_FileExists     INT
SET @l_Runtime = GETDATE()
SET @l_BackupFileName = ...
EXEC master.dbo.xp_fileexist @l_BackupFileName, @l_FileExists OUTPUT
IF @l_FileExists = 1
BEGIN
   EXECUTE master.dbo.xp_delete_file 0, @l_BackupFileName, '', @l_Runtime
END

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --