-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Version of the script
Version: 8.23
Date: 20241228
What is the current behavior?
When I run sp_DatabaseRestore it fails to run and return an error:
Msg 102, Level 15, State 1, Line 34
Incorrect syntax near 'RETUR'.
If the current behavior is a bug, please provide the steps to reproduce.
I installed the script in a database named NameOfCompany_Sql_Server_Maintenance_Solution (this part is important since the bug is related to it)
I execute the stored proc like this and the error occurs:
EXEC NameOfCompany_Sql_Server_Maintenance_Solution.dbo.sp_DatabaseRestore
@Database = 'MyDatabase',
@BackupPathFull = 'D:\Backups\MyDatabase\FULL\',
@BackupPathDiff = 'D:\Backups\MyDatabase\DIFF\',
@RestoreDiff = 1,
@RunRecovery = 1;
I narrowed it down to the variable @CommandExecuteCheck in the stored proc being not large enough to contain the script it needs to run with the current database name put inside it, so just increasing its size from 315 to 400 is enough for the stored proc to run properly.
What is the expected behavior?
No crash, stored proc restores the database
Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
Microsoft SQL Server 2019 (RTM-CU15) (KB5008996) - 15.0.4198.2 (X64) Jan 12 2022 22:30:08 Copyright (C) 2019 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)