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 : 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 nameDECLARE @fileName VARCHAR(256) -- filename for backupDECLARE @fileDate VARCHAR(20) -- used for file nameSELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)DECLARE cursor_backup CURSOR FORSELECT nameFROM master.dbo.sysdatabasesWHERE name NOT IN ('master','model','msdb','tempdb','AutoBakUP')OPEN cursor_backupFETCH NEXT FROM cursor_backup INTO @nameWHILE @@FETCH_STATUS = 0BEGINSET @fileName = '\\Mashayekhi\BackUP\' + @name + '_' + @fileDate + '.BAK'BACKUP DATABASE @name TO DISK = @fileNameFETCH NEXT FROM cursor_backup INTO @nameENDCLOSE cursor_backupDEALLOCATE cursor_backup |
|
|
|
|