Skip to content

Fix database_size_stats Int16 cast error on Azure SQL DB#498

Merged
erikdarlingdata merged 1 commit intodevfrom
feature/fix-int16-cast-495
Mar 9, 2026
Merged

Fix database_size_stats Int16 cast error on Azure SQL DB#498
erikdarlingdata merged 1 commit intodevfrom
feature/fix-int16-cast-495

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Fixes #495 — use Convert.ToInt32(reader.GetValue(n)) for integer columns that vary in type across editions.

…#495)

Azure SQL DB returns DB_ID() as smallint (Int16) instead of int (Int32),
causing an InvalidCastException in the database size collector. Use
Convert.ToInt32(reader.GetValue(n)) for database_id, file_id, and
compatibility_level columns to handle Int16/Int32/Int64 transparently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit d62f361 into dev Mar 9, 2026
3 checks passed
@erikdarlingdata erikdarlingdata deleted the feature/fix-int16-cast-495 branch April 9, 2026 00:33
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

Successfully merging this pull request may close these issues.

1 participant