Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 14.07.2007, 20:52   #1
Forcer
Архивный участник
 
Join Date: Apr 2006
Posts: 554
Default About SQL Backup

Hi, i badly know SQL, so i want to ask people.
I have scheduled job-command for backup, but i want to add postfix to end file name.
Like backup_lin2db_*DATETIME*.bak, backup_lin2db_07_07_07.bak or something else.

Anybody can advice me?
Forcer is offline  
Old 14.07.2007, 21:12   #2
hr
Архивный участник
 
Join Date: Jun 2005
Posts: 285
Default

Code:
create procedure sp_DBBackup
(
	@path varchar(200),
	@basename varchar(200)
)
as
begin
	declare @name varchar(500)
	select @name = @path + convert(varchar, getdate(), 105) + '(' + replace(convert(varchar, getdate(), 108), ':', '-') + ')' + @basename + '.bak'
	backup database @basename to disk = @name
end
go
usage:
Code:
exec sp_DBBackup 'c:\sql-backup\', 'database_name'
hr is offline  
Old 14.07.2007, 21:28   #3
Forcer
Архивный участник
 
Join Date: Apr 2006
Posts: 554
Default

Thanks, very useful
Forcer is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 16:16.