Skip to content

Arithmetic overflow error converting expression to data type int #10104

@tonyfountain

Description

@tonyfountain

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

Msg 8115, Level 16, State 2, Line 17
Arithmetic overflow error converting expression to data type int.

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference
[string[]]$SqlInstance = @('S1', 'S2', 'S3');
[string]$Database = 'myDB';
Get-DbaDbTable -SqlInstance $SqlInstance -Database $Database

Please confirm that you are running the most recent version of dbatools

2.7.20

Other details or mentions

We have some very large databases. This error occurs in the internal function Invoke-QueryDatabaseSizes of the cmdlet Get-DbaDatabase. Changing the queries to convert the 'size' column to a BIGINT should fix the underlying issue.

What PowerShell host was used when producing this error

VS Code (integrated terminal)

PowerShell Host Version

Name Value


PSVersion 5.1.22621.6345
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.6345
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2019 (RTM-CU32-GDR) (KB5068404) - 15.0.4455.2 (X64)
Oct 7 2025 21:10:15
Copyright (C) 2019 Microsoft Corporation
Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)

.NET Framework Version

.NET Framework 4.8.9310.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugs lifetriage requiredNew issue that has not been reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions