Home All Groups Group Topic Archive Search About

Properties of DB in SQL 2008 SSMS - Arithmetic overflow

Author
27 Jan 2009 9:25 PM
sql411@nospam.com

When in SSMS, I right-click and goto properties I get:

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

The query that is causing the error is:

DECLARE @is_policy_automation_enabled bit
SET @is_policy_automation_enabled = (
                                      SELECT    CONVERT(bit , current_value)
                                      FROM     
msdb.dbo.syspolicy_configuration
                                      WHERE     name = 'Enabled'
                                    )



SELECT  CAST(cast(g.name as varbinary(256)) AS sysname) AS [Name]
,       g.data_space_id AS [ID]
,       CAST(g.is_default AS bit) AS [IsDefault]
,       g.is_read_only AS [ReadOnly]
/* overflow is from next column */
,       CAST(ISNULL((
                      select    sum(gs.size) * convert(float , 8)
                      from      sys.database_files gs
                      where     gs.data_space_id = g.data_space_id
                    ) , 0) AS float) AS [Size]
,       CAST(CASE WHEN 'FD' = g.type THEN 1
                  ELSE 0
             END AS bit) AS [IsFileStream]
,       case when 1 = @is_policy_automation_enabled
                  and exists ( select   *
                               from     msdb.dbo.syspolicy_system_health_state
                               where    target_query_expression_with_id like
'Server' + '/Database\[@ID=' + convert(nvarchar(20) , dtb.database_id) + '\]'
+ '/FileGroup\[@ID=' + convert(nvarchar(20) , g.data_space_id) + '\]%' ESCAPE
'\' ) then 1
             else 0
        end AS [PolicyHealthState]
FROM    master.sys.databases AS dtb
,       sys.filegroups AS g
WHERE   ( dtb.name = db_name() )
ORDER BY [Name] ASC



The database is 23.22 TB, so I think the casting to a bigint is required,
but this is internal SQL code generated from SSMS. 


Anyone run into this and no of a workaround?


Thanks,
Robert
Author
27 Jan 2009 10:42 PM
Erland Sommarskog
sql411@nospam.com (sql411nospamcom@discussions.microsoft.com) writes:
Show quoteHide quote
> When in SSMS, I right-click and goto properties I get:
>
> Msg 8115, Level 16, State 2, Line 11
> Arithmetic overflow error converting expression to data type int.
>
> The query that is causing the error is:
>...
> /* overflow is from next column */
> ,       CAST(ISNULL((
>                       select    sum(gs.size) * convert(float , 8)
>                       from      sys.database_files gs
>                       where     gs.data_space_id = g.data_space_id
>                     ) , 0) AS float) AS [Size]
> ,       CAST(CASE WHEN 'FD' = g.type THEN 1
>...
>
> The database is 23.22 TB, so I think the casting to a bigint is required,
> but this is internal SQL code generated from SSMS. 

Great catch! It's difficult to think of other workarounds than silly
ones like "don't right-click there" or "make your database smaller".

However, what you absolutely should do is submit this on
http://connect.microsoft.com/sqlserver/feedback. That's the best
way to make Microsoft aware of this issue.


--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Are all your drivers up to date? click for free checkup

Author
27 Jan 2009 11:03 PM
sql411@nospam.com
Erland, thanks for the suggestion to post to connect.microsoft.com.

I did and here is the link:
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=406510

Thanks again,
Robert Towne

Bookmark and Share