备份还原数据库
程序员文章站
2022-06-11 10:10:21
...
创建存储过程 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'