我正在尝试使用以下存储过程,但出现错误
消息8115,级别16,状态2,过程xlaAFSsp_reports,第25行将
表达式转换为数据类型int的算术溢出错误。第24行:将myadapter调暗为新的SqlDataAdapter(mycommand)
第25行:mycommand.CommandType = CommandType.StoredProcedure
第26行:myadapter.fill(ds,“ results”)
第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
听起来其中一个总和大于2,147,483,647。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句