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.
Author |
Topic |
HadiMMM
Starting Member
5 Posts |
Posted - 2010-11-22 : 02:54:44
|
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 |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-11-22 : 05:33:51
|
Not sure what the question isI would do the backup to a local disk (on the server) then copy to the client if possible.Remember that if you do a backup like this it will invalidate any differentials that are being carried out on the server (you could do a copy backup though).==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|