Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arithmetic overflows in view_IndexInformation_CurrentDB; No data output #306

Open
Hedrik opened this issue Jan 6, 2024 · 1 comment
Open

Comments

@Hedrik
Copy link

Hedrik commented Jan 6, 2024

Freshly downloaded from GitHub. No usage instructions found, so I just added a 'USE {Db}' at the top and ran it. Here is the relevant part of the message output - I suspect that the script may need to be updated to use the bigint type instead of int - I will report back if I attempt again after changing to bigint, though given that it took 6 and 1/2 hours to run, I may just wait on that...: (then again, I don't see anything even possible in the region of the line reported as having the
error, so...)

.
.
.
Msg 8115, Level 16, State 2, Line 416
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.
Msg 8115, Level 16, State 2, Line 416
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.
Msg 8115, Level 16, State 2, Line 416
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.
Msg 8115, Level 16, State 2, Line 416
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.
.
.
.
Msg 8152, Level 16, State 10, Line 3
String or binary data would be truncated.

And the result had no data:

image

@matthiaslueken
Copy link

Same, the overflow happens when aggregating the record_count on lines 424 - 423:

SUM(ISNULL(ps.record_count,0)),
SUM(ISNULL(ps.forwarded_record_count,0)) -- for heaps

Solution: change the datatype of the temp table to bigint (lines 86 - 96):

CREATE TABLE #tmpIPS (
	[database_id] int,
	[object_id] int,
	[index_id] int,
	[partition_number] int,
	fragmentation DECIMAL(18,3),
	[page_count] bigint,
	[size_MB] DECIMAL(26,3),
	record_count **bigint**,
	forwarded_record_count **bigint** NULL,
	CONSTRAINT PK_IPS PRIMARY KEY CLUSTERED(database_id, [object_id], [index_id], [partition_number]))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants