I am using OLE Automation Stored Procedure sp_OAGetProperty to get a property value of an OLE object
Code
declare @fsobj int
declare @fsfile int
declare @size bigint
declare @error int
declare @path varchar(255)
declare @tempfilepath varchar(512)
set @fsobj = null
SET @PATH = (SELECT TOP(1) [PATH] FROM DMS_PATH WHERE [TYPE] IN (3, 99) ORDER BY [TYPE] DESC)
set @tempfilepath = @path + '\' + 'HCN_e71efb49b22b44fc98ad10aa751a0744.tmp'
print @tempfilepath
-- create file system object
exec @error = sp_OACreate 'Scripting.FileSystemObject', @fsobj OUT;
exec @error = sp_OAMethod @fsobj, 'GetFile', @fsfile OUT, @tempfilepath;
exec @error =sp_OAGetProperty @fsfile, 'Size', @size OUT;
--------------------------------------------------------------------------------------------------------
Getting below error when "exec @error =sp_OAGetProperty @fsfile, 'Size', @size OUT;" is executed
Msg 596, Level 21, State 1, Line 0
Cannot continue the execution because the session is in the kill state.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Same above code working fine in SQL-2008 and SQL-2012
Further analysis
observed that it is working fine in SQL-2019 also if we change data type of @size variable from bigint to int
Not sure why error is occurring with bigint data type in SQL Server Express-2019