March 14, 2007 at 2:04 am
Hi Guys,
I have the following stored proc. When i run this proc on one of our servers, we get this error:
0x80028019 - ODSOLE Extended Procedure - Old format or invalid type library.
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create PROCEDURE sp__DiskSpace
as
SET NOCOUNT ON
DECLARE @hr int
DECLARE @fso int
DECLARE @drive char(1)
DECLARE @odrive int
DECLARE @TotalSize varchar(20)
DECLARE @MB bigint ; SET @MB = 1048576
DECLARE @GB bigint ; SET @GB = 1024
INSERT drivesspace(drive,FreeSpace)
EXEC master.dbo.xp_fixeddrives
EXEC @hr=sp_OACreate 'Scripting.FileSystemObject',@fso OUT
IF @hr <> 0 EXEC sp_OAGetErrorInfo @fso
DECLARE dcur CURSOR LOCAL FAST_FORWARD
FOR SELECT drive from drivesspace
ORDER by drive
OPEN dcur
FETCH NEXT FROM dcur INTO @drive
WHILE @@FETCH_STATUS=0
BEGIN
EXEC @hr = sp_OAMethod @fso,'GetDrive', @odrive OUT, @drive
IF @hr <> 0 EXEC sp_OAGetErrorInfo @fso
EXEC @hr = sp_OAGetProperty @odrive,'TotalSize', @TotalSize OUT
IF @hr <> 0 EXEC sp_OAGetErrorInfo @odrive
UPDATE drivesspace
WHERE drive=@drive
FETCH NEXT FROM dcur INTO @drive
END
CLOSE dcur
DEALLOCATE dcur
EXEC @hr=sp_OADestroy @fso
IF @hr <> 0 EXEC sp_OAGetErrorInfo @fso
SELECT @@ServerName as ServerName,
Drive as DriveLetter,
TotalSize as 'DriveSize(MB)',
CAST((TotalSize / @GB) as dec(20)) as 'DriveSize(GB)',
FreeSpace as 'FreeSpace(MB)',
CAST((FreeSpace / @GB) as dec(20)) as 'FreeSpace(GB)',
CAST((FreeSpace/(TotalSize*1.0))*100.0 as int) as 'Free(%)',
CAST((100-(FreeSpace/(TotalSize*1.0))*100.0) as int) as 'Full(%)',
convert(varchar(8),getdate(),112) as RunDate
FROM drivesspace
ORDER BY drive
truncate TABLE drivesspace
RETURN
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
Can anyone pls help?
Regards
March 14, 2007 at 10:34 am
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply