File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ ALTER PROCEDURE [dbo].[sp_DatabaseRestore]
39
39
@Version VARCHAR (30 ) = NULL OUTPUT ,
40
40
@VersionDate DATETIME = NULL OUTPUT ,
41
41
@VersionCheckMode BIT = 0 ,
42
- @FileNamePrefix NVARCHAR (260 ) = NULL
42
+ @FileNamePrefix NVARCHAR (260 ) = NULL ,
43
+ @RunStoredProcAfterRestore NVARCHAR (260 ) = NULL
43
44
AS
44
45
SET NOCOUNT ON ;
45
46
SET STATISTICS XML OFF ;
@@ -1637,6 +1638,29 @@ END;'
1637
1638
-- If test restore then blow the database away (be careful)
1638
1639
IF @TestRestore = 1
1639
1640
BEGIN
1641
+
1642
+ IF @RunStoredProcAfterRestore IS NOT NULL AND LEN (LTRIM (@RunStoredProcAfterRestore)) > 0
1643
+ BEGIN
1644
+ PRINT ' Attempting to run ' + @RunStoredProcAfterRestore
1645
+ SET @sql = N ' EXEC ' + @RestoreDatabaseName + ' .' + @RunStoredProcAfterRestore
1646
+
1647
+ IF @Debug = 1 OR @Execute = ' N'
1648
+ BEGIN
1649
+ IF @sql IS NULL PRINT ' @sql is NULL when building for @RunStoredProcAfterRestore'
1650
+ PRINT @sql
1651
+ END
1652
+
1653
+ IF @RunRecovery = 0
1654
+ BEGIN
1655
+ PRINT ' Unable to run Run Stored Procedure After Restore as database is not recovered. Run command again with @RunRecovery = 1'
1656
+ END
1657
+ ELSE
1658
+ BEGIN
1659
+ IF @Debug IN (0 , 1 ) AND @Execute = ' Y'
1660
+ EXEC sp_executesql @sql
1661
+ END
1662
+ END
1663
+
1640
1664
SET @sql = N ' DROP DATABASE ' + @RestoreDatabaseName + NCHAR (13 );
1641
1665
1642
1666
IF @Debug = 1 OR @Execute = ' N'
You can’t perform that action at this time.
0 commit comments