Error message when you run the sp_databases stored procedure in SQL Server 2000: "Arithmetic overflow error converting expression to data type int" (914534)
The information in this article applies to:
- Microsoft SQL Server 2000 Personal Edition
- Microsoft SQL Server 2000 Standard Edition
- Microsoft SQL Server 2000 Workgroup Edition
- Microsoft SQL Server 2000 Developer Edition
- Microsoft SQL Server 2000 Enterprise Edition
- Microsoft SQL Server 2000 Developer Edition 64 bit
- Microsoft SQL Server 2000 Enterprise Edition 64-bit
Bug #: 474872 (SQL Server 8.0)
SYMPTOMSWhen you run the sp_databases stored procedure in Microsoft SQL Server 2000, you may receive the following error message: Msg 8115, Level 16, State 2, Procedure sp_databases, Line 31 Arithmetic overflow error converting expression to data type int CAUSEThe problem occurs because the size of a database in SQL Server 2000 exceeds 2 terabytes.WORKAROUNDTo work around this problem, run the following query instead of the sp_databases stored procedure: set nocount on
declare @name sysname
declare @SQL nvarchar(600)
create table #databases (
DATABASE_ID int NOT NULL,
size bigint NOT NULL)
declare c1 cursor for
select name from master.dbo.sysdatabases
where has_dbaccess(name) = 1
open c1
fetch c1 into @name
while @@fetch_status >= 0
begin
select @SQL = 'insert into #databases select '+
convert(sysname, db_id(@name)) +
', sum(convert(bigint,size)) from ' +
QuoteName(@name) + '.dbo.sysfiles'
execute (@SQL)
fetch c1 into @name
end
deallocate c1
select
DATABASE_NAME = db_name(DATABASE_ID),
DATABASE_SIZE = convert(bigint,size)*8,
REMARKS = convert(varchar(254),null)
from #databases
order by 1
drop table #databases
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Modification Type: | Major | Last Reviewed: | 2/21/2006 |
---|
Keywords: | kbExpertiseAdvanced kbtshoot kbprb KB914534 kbAudDeveloper kbAudITPRO |
---|
|