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 f98d732

Browse files
Update shrink-data-files-incrementally.sql
1 parent e9c5af7 commit f98d732

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎QueryTemplates/Common Scripts/shrink-data-files-incrementally.sql‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
-- Enter the file name you want to shrink and target file size
22
-- File will be shrinked in a loop by one gigabyte at a time
33
DECLARE @FileName VARCHAR(100) = 'file_name';
4-
DECLARE @DesiredSize INT = 30000;
4+
DECLARE @DesiredSize BIGINT = 30000;
55

6-
DECLARE @CurrentSize INT;
7-
SELECT @CurrentSize = ROUND(size * 8 / 1024, -3) FROM sys.database_files WHERE name = @FileName
6+
DECLARE @CurrentSize BIGINT;
7+
SELECT @CurrentSize = ROUND(CAST(sizeASBIGINT) * 8 / 1024, -3) FROM sys.database_files WHERE name = @FileName
88

99
WHILE (@CurrentSize > @DesiredSize)
1010
BEGIN

0 commit comments

Comments
(0)

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