Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4802405

Browse files
Merge pull request BrentOzarULTD#1194 from ShawnCrocker/issue_1192
sp_DatabaseRestore - Fix @MoveFile dependency bug Issue 1192 BrentOzarULTD#1192
2 parents 3f030b3 + 71d640f commit 4802405

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎sp_DatabaseRestore.sql‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,23 @@ IF (SELECT RIGHT(@BackupPathLog, 1)) <> '\' --Has to end in a '\'
327327
END;
328328

329329
/*Move Data File*/
330+
IF NULLIF(@MoveDataDrive, '') IS NULL
331+
BEGIN
332+
RAISERROR('Getting default data drive for @MoveDataDrive', 0, 1) WITH NOWAIT;
333+
SET @MoveDataDrive = CAST(SERVERPROPERTY('InstanceDefaultDataPath') AS nvarchar(260));
334+
END;
330335
IF (SELECT RIGHT(@MoveDataDrive, 1)) <> '\' --Has to end in a '\'
331336
BEGIN
332337
RAISERROR('Fixing @MoveDataDrive to add a "\"', 0, 1) WITH NOWAIT;
333338
SET @MoveDataDrive += N'\';
334339
END;
335340

336341
/*Move Log File*/
342+
IF NULLIF(@MoveLogDrive, '') IS NULL
343+
BEGIN
344+
RAISERROR('Getting default log drive for @@MoveLogDrive', 0, 1) WITH NOWAIT;
345+
SET @MoveLogDrive = CAST(SERVERPROPERTY('InstanceDefaultLogPath') AS nvarchar(260));
346+
END;
337347
IF (SELECT RIGHT(@MoveLogDrive, 1)) <> '\' --Has to end in a '\'
338348
BEGIN
339349
RAISERROR('Fixing @MoveDataDrive to add a "\"', 0, 1) WITH NOWAIT;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /