Question : SELECT COUNT(*) issues msg 8115

I am in the process of migrating from v2000 to v2008.  I copied all the tables over the weekend from the v2000 production source dataset, to the v2008 dataset-to-be.  some of them are pretty bloody big.  all data copies succeeded fine.  Just now I was attempting a simple row count:

select count(*) from tablename

it ran for :43:56, and failed, issuing this:
Msg 8115, Level 16, State 2, Line 2
Arithmetic overlfow error converting expression to data type int.

table def is simple:  
  inserttime   datetime2
  eventtime datetime2
  mtype char(1)
  mindex int
  orderid char(16)
  reqid char(100)
  gid int

interestingly enough, from v2000 enterprise mgr, just dbl clicking a couple of the bigger tables (in the production source dataset) errors out w/the same message.  hit ok on the error, it goes away and returns me the table properties.

in the v2000 production dataset i am pretty worried that i've reached a max on bigint.  why else would i gen that error?  but, checkident does not indicate that to be the problem.

even if that were the case, i don't see the relation to the v2008 select count(*) i just ran.  i know the table is sitting upwards of 1.7B records.  the mindex never exceeds 4 and the gid is static data, the max gid is 3158.  there is no other int/bigint in the table def.

why would a simple select count(*) issue the arithmetic overflow?

Answer : SELECT COUNT(*) issues msg 8115

How about using COUNT_BIG :-)
Random Solutions  
 
programming4us programming4us