如何通过存储过程恢复sql server 2005中的数据库备份?

问题描述:

如何通过存储过程恢复sql server 2005中的数据库备份?

How to restore back up of DB in sql server 2005 via Stored Procedure?

尝试google .. :)



try to google.. :)

CREATE PROCEDURE sp_RestoreDatabase
	@DatabaseName varchar(150)='',
	@FilePath nvarchar(max)='',
	@strQuery nvarchar(max)=''
AS
BEGIN
 select @strQuery='RESTORE DATABASE'+@DatabaseName+' FROM DISK = '+@FilePath;
 exec(@strQuery);
END
GO





你可以动态地填充 @DatabaseName @FilePath :)



或参考参考资料...... :)



如何在同一路径中恢复包含.mdf和.ldf的查询的数据库.bak文件 [ ^ ]



使用Sql Server 2005恢复数据库备份(.bak) [ ^ ]



SQL Server数据库恢复移动与否移动 [ ^ ]



恢复数据库SQL服务器查询 [ ^ ]



you can padd @DatabaseName and @FilePathdynamically.. :)

or see references... :)

how to restore database .bak file with query including .mdf and .ldf in same path[^]

Restore backup of database (.bak) using Sql Server 2005[^]

SQL Server Database RESTORE WITH MOVE or not WITH MOVE[^]

Restore database SQL server query[^]