当前位置:Gxlcms > mysql > 备份还原数据库

备份还原数据库

时间:2021-07-01 10:21:17 帮助过:31人阅读

创建存储过程 CREATE PROCEDURE protest ( @var1 int, @var2 int, @var3 int output ) AS set @var3=@var1+@var2+@var3 return @var3 GO 运用存储过程 declare @var1 int set @var1='1' declare @var2 int set @var2='2' declare @var3 int set @var3='3' ex

创建存储过程
CREATE PROCEDURE protest
(
@var1 int,
@var2 int,
@var3 int output
)
AS
set @var3=@var1+@var2+@var3
return @var3
GO

运用存储过程
declare @var1 int
set @var1='1'
declare @var2 int
set @var2='2'
declare @var3 int
set @var3='3'
exec protest @var1,@var2,@var3 output
select @var3

备份数据库
backup database pubs
to disk='c:/test/pubs.bak'

还原数据库
restore database test
from disk='c:/test/pubs.bak'
with move 'pubs' to 'c:/test/test.mdf',
move 'pubs_log' to 'c:/test/test.ldf'

人气教程排行