use master
go
declare @getday varchar(50)
select @getday = convert(varchar(20),getdate(),112)
if exists (select * from dbo.sysdevices where name=@getday)
exec('sp_dropdevice '+@getday)
go
declare @getday varchar(50)
select @getday = convert(varchar(20),getdate(),112)
if exists (select * from dbo.sysdevices where name=@getday)
exec('sp_dropdevice '+@getday)
go
declare @getday varchar(50),@path varchar(50)
select @getday = convert(varchar(20),getdate(),112)
select @path = 'd:\bak' + @getday + '.bak'
if exists (select * from dbo.sysdevices where name=@getday)
exec('sp_dropdevice '+@getday)
exec('sp_addumpdevice' +'disk' + @getday +@path)这里又是什么地方错了!?
go
declare @getday varchar(50),@path varchar(50)
select @getday = convert(varchar(20),getdate(),112)
select @path = 'd:\bak\' + @getday + '.bak'
if exists (select * from dbo.sysdevices where name=@getday)
exec('sp_dropdevice '+@getday)
exec('sp_addumpdevice ''disk'','''+@getday+''','+''''+@path+'''')
go
declare @getday varchar(50),@path varchar(50)
select @getday = convert(varchar(20),getdate(),112)
select @path = 'd:\bak\' + @getday + '.bak'
if exists (select * from dbo.sysdevices where name=@getday)
exec sp_dropdevice @getday
exec sp_addumpdevice 'disk',@getday ,@path
我自己找到了这个方法写,好像更容易理解些!不过还是要谢谢你热心帮助我!