写个存储过程! 执行存储哦过程就行了!!把 备份的路径当参数传给存储过程
CREATE PROCEDURE [dbo].[backstore] AS
declare @strback varchar(2000)
declare @bakstr varchar(128)
set @bakstr=convert(varchar,getdate(),12)+convert(varchar(10),datename(hh,getdate()))+convert(varchar(10),datename(mm,getdate()))+convert(varchar(10),datename(ss,getdate()))
set @strback='BACKUP DATABASE [eipnew] TO DISK = N''E:\hysoft\soft\pf\sqlpeobak\'+@bakstr+'eipnew.rar'' WITH NOINIT , NOUNLOAD , NAME = N''eipnew 备份'', NOSKIP , STATS = 10, NOFORMAT'
--select @strback
exec (@strback)
select @bakstr+'eipnew.rar'
GO
和平时你使用查询是一样的。
strsql = "backup database oldname to disk='d:\newname.bak' with name='oldname backup all',description='Full Backup Of oldname"