Skip to content

Commit 8fca53a

Browse files
authored
Update sp_DatabaseRestore.sql
When I look at what the code does, it isn't necessarily testing the database - it's really just running a stored proc after the restore finishes. This functionality could be good for other stuff too, like obscuring data or changing permissions. I switched the parameter name from @VerifyRestoreWithStoredProcedure to @RunStoredProcAfterRestore.
1 parent c5e2734 commit 8fca53a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sp_DatabaseRestore.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ALTER PROCEDURE [dbo].[sp_DatabaseRestore]
4040
@VersionDate DATETIME = NULL OUTPUT,
4141
@VersionCheckMode BIT = 0,
4242
@FileNamePrefix NVARCHAR(260) = NULL,
43-
@VerifyRestoreWithStoredProcedure NVARCHAR(260) = NULL
43+
@RunStoredProcAfterRestore NVARCHAR(260) = NULL
4444
AS
4545
SET NOCOUNT ON;
4646
SET STATISTICS XML OFF;
@@ -1639,20 +1639,20 @@ END;'
16391639
IF @TestRestore = 1
16401640
BEGIN
16411641

1642-
IF @VerifyRestoreWithStoredProcedure IS NOT NULL AND LEN(LTRIM(@VerifyRestoreWithStoredProcedure)) > 0
1642+
IF @RunStoredProcAfterRestore IS NOT NULL AND LEN(LTRIM(@RunStoredProcAfterRestore)) > 0
16431643
BEGIN
1644-
PRINT 'Attempting to run ' + @VerifyRestoreWithStoredProcedure
1645-
SET @sql = N'EXEC ' + @RestoreDatabaseName + '.' + @VerifyRestoreWithStoredProcedure
1644+
PRINT 'Attempting to run ' + @RunStoredProcAfterRestore
1645+
SET @sql = N'EXEC ' + @RestoreDatabaseName + '.' + @RunStoredProcAfterRestore
16461646

16471647
IF @Debug = 1 OR @Execute = 'N'
16481648
BEGIN
1649-
IF @sql IS NULL PRINT '@sql is NULL for Verify Restore with Stored Procedure'
1649+
IF @sql IS NULL PRINT '@sql is NULL when building for @RunStoredProcAfterRestore'
16501650
PRINT @sql
16511651
END
16521652

16531653
IF @RunRecovery = 0
16541654
BEGIN
1655-
PRINT 'Unable to run Verify Restore with Stored Procedure as database is not recovered. Run command again with @RunRecovery = 1'
1655+
PRINT 'Unable to run Run Stored Procedure After Restore as database is not recovered. Run command again with @RunRecovery = 1'
16561656
END
16571657
ELSE
16581658
BEGIN

0 commit comments

Comments
 (0)