Skip to content

Commit

Permalink
Update create_database_snapshot.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
EitanBlumin committed Nov 27, 2023
1 parent d10b2ee commit e4e5418
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Utility Scripts/create_database_snapshot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ DECLARE

DECLARE @CMD NVARCHAR(MAX), @SnapshotName SYSNAME;

SET @SnapshotName = @CurrDB + '_snapshot_' + CONVERT(nvarchar, GETDATE(), 112) + REPLACE(CONVERT(nvarchar, GETDATE(), 114),':','');
SET @SnapshotName = @CurrDB + '_snapshot_' + CONVERT(nvarchar(25), GETDATE(), 112) + REPLACE(CONVERT(nvarchar(25), GETDATE(), 114),':','');

SELECT @CMD = ISNULL(@CMD + N',
', N'') + N'(NAME = ' + QUOTENAME(name) + N'
, FILENAME = ' + QUOTENAME(LEFT(physical_name, LEN(physical_name) - CHARINDEX('\', REVERSE(physical_name)) + 1)
+ @SnapshotName + N'_' + name + '.ss', N'''')
+ N')'
, FILENAME = ''' + LEFT(physical_name, LEN(physical_name) - CHARINDEX('\', REVERSE(physical_name)) + 1)
+ @SnapshotName + N'_' + name + '.ss'
+ N''')'
FROM sys.master_files
WHERE type <> 1
WHERE type = 0
AND database_id = DB_ID(@CurrDB)

SELECT
Expand Down

0 comments on commit e4e5418

Please sign in to comment.