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

SQL Server Input - Arithmetic overflow error converting numeric to data type int. #2077

Closed
Kebus1 opened this issue Nov 23, 2016 · 2 comments
Labels
bug unexpected problem or unintended behavior
Milestone

Comments

@Kebus1
Copy link
Contributor

Kebus1 commented Nov 23, 2016

Bug report

I think there a bug within the SQL code for big databases.

file concerned : sqlserver.go
Lines : 406 and 407

SELECT
    DB_NAME(mf.database_id) AS database_name ,
    mf.size as database_size_8k_pages,
    mf.max_size  as database_max_size_8k_pages,
    size_on_disk_bytes,
	type_desc as datafile_type,
    GETDATE() AS baselineDate
INTO #baseline

With patching : add a cast operation for forcing in a BIGINT datatype

SELECT
    DB_NAME(mf.database_id) AS database_name ,
    CAST(mf.size AS BIGINT) as database_size_8k_pages,
    CAST(mf.max_size AS BIGINT)  as database_max_size_8k_pages,
    size_on_disk_bytes,
	type_desc as datafile_type,
    GETDATE() AS baselineDate
INTO #baseline

The bug is generated by query on lines 479 to 486.

SELECT measurement = ''Logs max size (8KB pages)'', servername = REPLACE(@@SERVERNAME, ''\'', '':''), type = ''Database size''
, ' + @ColumnName + '  FROM
(
SELECT database_name, database_max_size_8k_pages
FROM #baseline
WHERE datafile_type = ''LOG''
) as V
PIVOT(SUM(database_max_size_8k_pages) FOR database_name IN (' + @ColumnName + ')) AS PVTTable

I test all queries in file sqlserver.go on my databases and the only error is generated by query above.
I can't release windows binaries so i can't test on my system the binaries.

@sparrc
Copy link
Contributor

sparrc commented Nov 23, 2016

thanks, would you be able to submit a PR?

@sparrc sparrc added the bug unexpected problem or unintended behavior label Nov 23, 2016
@sparrc sparrc added this to the Future Milestone milestone Nov 23, 2016
@Kebus1 Kebus1 mentioned this issue Dec 30, 2016
3 tasks
@sparrc sparrc modified the milestones: 1.3.0, Future Milestone Jan 9, 2017
@sparrc
Copy link
Contributor

sparrc commented Jan 13, 2017

closed by #2212

@sparrc sparrc closed this as completed Jan 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants