Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 High Availability (2005)
 copy backups into clients computer

Author  Topic 

HadiMMM
Starting Member

5 Posts

Posted - 2010-11-22 : 03:07:04
hi.
sorry i can speak english very well.
i have some database's.
i want in time 11PM Backup from databases and copy them into the client from domain server.
for example into the folder \\Mashayekhi\Backup
.
folder Backup from Mashayekhi Computer have all permissions for read and write.
what can i do from this work.
my Query is :
DECLARE @name VARCHAR(50) -- database name
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
DECLARE cursor_backup CURSOR FOR
SELECT name
FROM master.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb','AutoBakUP')
OPEN cursor_backup
FETCH NEXT FROM cursor_backup INTO @name
WHILE @@FETCH_STATUS = 0
BEGIN
SET @fileName = '\\Mashayekhi\BackUP\' + @name + '_' + @fileDate + '.BAK'
BACKUP DATABASE @name TO DISK = @fileName
FETCH NEXT FROM cursor_backup INTO @name
END
CLOSE cursor_backup
DEALLOCATE cursor_backup
   

- Advertisement -