sql2005备份在sql2000中恢复
Http://www.Egocbd.com 点击数: 更新时间:2010-2-3 10:44:28
bsp; varchar(20)
declare #spid cursor for
select spid=cast(spid as varchar(20)) from master..sysprocesses where dbid=db_id(@dbname)
open #spid
fetch next from #spid into @spid
while @@fetch_status=0
begin
exec( kill +@spid)
fetch next from #spid into @spid
end
close #spid
deallocate #spid
end
--恢复数据库
exec(@sql)
go
declare #spid cursor for
select spid=cast(spid as varchar(20)) from master..sysprocesses where dbid=db_id(@dbname)
open #spid
fetch next from #spid into @spid
while @@fetch_status=0
begin
exec( kill +@spid)
fetch next from #spid into @spid
end
close #spid
deallocate #spid
end
--恢复数据库
exec(@sql)
go