我正在尝试使用以下存储过程,但我收到错误
Msg 8115,Level 16,State 2,Procedure xlaAFSsp_reports,Line 25
将表达式转换为数据类型int的算术溢出错误。第24行:将myadapter调暗为New SqlDataAdapter(mycommand)
第25行:mycommand.CommandType = CommandType.StoredProcedure
第26行:myadapter.fill(ds,“结果”)
第27行:
第28行:rs = ds.tables(0).rows(0)
表中的值不是0
知道是什么原因引起的吗?
ALTER PROCEDURE [dbo].[xlaAFSsp_reports]
AS
SET NOCOUNT ON
-- Consolidate disk size (also done on xlaAFSsp_expire_files)
UPDATE xlaAFSstorages
SET currentsize = ISNULL((select SUM(filesize)
from xlaAFSfiles
where s3 = 0
and storageid = xlaAFSstorages.storageid), 0)
create table #ttable (
totalfiles int,
usedspace int,
nonexpiring int,
protected int,
totalusers int,
paidusers int,
totalstorages int,
allocatedspace int,
)
-- Total Stats
insert into #ttable (totalfiles, usedspace, nonexpiring, protected, totalusers, paidusers, totalstorages, allocatedspace)
values (0, 0, 0, 0, 0, 0, 0, 0)
update #ttable
set totalfiles = (Select count(fileid) from xlaAFSfiles),
usedspace = (Select isnull(sum(filesize), 0) from xlaAFSfiles),
nonexpiring = (Select count(fileid) from xlaAFSfiles
where fsid in (select fsid from xlaAFSfilesets
where expiredate = '-')),
protected = (Select count(fileid) from xlaAFSfiles
where fsid in (select fsid from xlaAFSfilesets
where accesspwd <> '')),
totalusers = (Select COUNT(userid) from xlaAFSusers),
paidusers = (Select COUNT(userid) from xlaAFSusers where ispaid <> ''),
totalstorages = (Select COUNT(storageid) from xlaAFSstorages),
allocatedspace = (Select isnull(SUM(allocatedsize),-1)
from xlaAFSstorages)
select * from #ttable
drop table #ttable