Just set the values of the variables
SET @BackupFolder = 'the folder'
SET @DatabaseName = 'the database name'
Carolyn Richardson,
2011-08-18 (first published: 2011-08-04)
Just set the values of the variables
SET @BackupFolder = 'the folder'
SET @DatabaseName = 'the database name'
EXEC sp_configure 'show advanced options' ,1 RECONFIGURE EXEC sp_configure 'xp_cmdshell',1 RECONFIGURE SET NOCOUNT ON DECLARE @BackupFolder VARCHAR (2000) DECLARE @DatabaseName VARCHAR (200) DECLARE @Command VARCHAR(100) SET @Command = 'dir '+ @BackupFolder +'*.bak /b /s ' DECLARE @FilesFolder TABLE (FileNames VARCHAR(500)) INSERT INTO @FilesFolder EXEC MASTER..xp_cmdshell @Command SELECT max(FileNames) as 'backup' FROM @FilesFolder WHERE FileNames like ''+ @DatabaseName +'' EXEC sp_configure 'show advanced options' ,0 RECONFIGURE
Have you ever wished that creating a backup on the fly was easier and quicker? Whether you do it with the GUI or with T-SQL, you still have to open up Management Studio, connect to the database, and go through the steps. You have to figure out ...
2009-04-29
4,263 reads
Is there a way I can automate a file deletion process from within SQL Server?
2008-11-11
4,819 reads
There are a lot of scripts out there that will allow you to use the msdb to auto-generate restore scripts, but what if you cannot access the msdb database. What is the easiest way to make sure I have the proper restore scripts on hand without relying on the msdb database?
2008-11-07
3,562 reads
As a DBA you need to ensure that the databases you manage are backed up regularly. This article details the importance of database backups and a recovery plan
2008-10-15
2,652 reads
One of the first things that should be done when managing SQL Server is to setup an appropriate backup plan in order to minimize any data loss in the event of a failure. Along with setting up a backup plan there are certain database configurations that need to be setup to ensure you are able to backup databases correctly. In this tip we will look at the different recovery models that SQL Server offers and how to choose a recovery model for your database.
2008-05-30
4,151 reads