You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* See if we can get the instant_file_initialization_enabled column from sys.dm_server_services */
8725
+
IFEXISTS
8726
+
(
8727
+
SELECT1/0
8728
+
FROMsys.all_columns
8729
+
WHERE [object_id] =OBJECT_ID(N'[sys].[dm_server_services]')
8730
+
AND [name] =N'instant_file_initialization_enabled'
8731
+
)
8732
+
BEGIN
8733
+
/* This needs to be a "dynamic" SQL statement because if the 'instant_file_initialization_enabled' column doesn't exist the procedure might fail on a bind error */
8734
+
SET @StringToExecute =N'SELECT @IFISetting = instant_file_initialization_enabled'+ @crlf +
8735
+
N'FROM sys.dm_server_services'+ @crlf +
8736
+
N'WHERE filename LIKE ''%sqlservr.exe%'''+ @crlf +
8737
+
N'OPTION (RECOMPILE);';
8731
8738
8732
8739
IF @Debug =2AND @StringToExecute ISNOTNULLPRINT @StringToExecute;
8733
8740
IF @Debug =2AND @StringToExecute ISNULLPRINT'@StringToExecute has gone NULL, for some reason.';
@@ -8736,14 +8743,13 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
8736
8743
@StringToExecute
8737
8744
,N'@IFISetting varchar(1) OUTPUT'
8738
8745
,@IFISetting = @IFISetting OUTPUT
8739
-
ENDTRY
8740
-
BEGINCATCH
8741
-
/* We couldn't get the instant_file_initialization_enabled column from sys.dm_server_services, fall back to read error log */
8742
-
SET @IFIReadDMVFailed =1;
8743
-
ENDCATCH;
8744
-
8745
-
IF @IFIReadDMVFailed =1
8746
+
8747
+
SET @IFIReadDMVFailed =0;
8748
+
END
8749
+
ELSE
8750
+
/* We couldn't get the instant_file_initialization_enabled column from sys.dm_server_services, fall back to read error log */
8746
8751
BEGIN
8752
+
SET @IFIReadDMVFailed =1;
8747
8753
/* If this is Amazon RDS, we'll use the rdsadmin.dbo.rds_read_error_log */
0 commit comments