George
George

Reputation: 61

create xml schema collection maximum value of fractionDigits restriction

I'm trying to load third party XSD Scheme to my SQL Server 2008 throught "create xml schema collection" statement

There is a complex type based on "xs:decimal" with restrictions:

        <xs:totalDigits value="31"/>
        <xs:fractionDigits value="14"/>

inside the XSD.

And SQL Server returns error

Msg 6960, Level 16, State 2, Line 2
Component 'NAME' is outside of allowed range. Maximum for 'fractionDigits' is 10 and maximum number of digits for non fractional part is 28

But I still able to create a variable with type "numeric(31,14)"

I didn't find any restrictions neither on w3c documentations nor in MSDN. Can you please guide me to some documentation on this restrictions. May be I can fix it with some Service Pack or Setting.

SQL Server version: Microsoft SQL Server 2008 (SP3) - 10.0.5500.0 (X64) Sep 21 2011 22:45:45 Copyright (c) 1988-2008 Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)


I found an answer on the MSDN (http://msdn.microsoft.com/en-us/library/ms190665(v=sql.100).aspx)

SQL Server does not support variable precision decimals. The xs:decimal type represents arbitrary precision decimal numbers. Minimally conforming XML processors must support decimal numbers with a minimum of totalDigits=18. SQL Server supports totalDigits=38, but limits the fractional digits to 10. All xs:decimal instanced values are represented internally by the server by using the SQL type numeric (38, 10).

They map xs:decimal not to numeric type, but decimal

Upvotes: 4

Views: 961

Answers (1)

George
George

Reputation: 61

I found an answer on the MSDN (http://msdn.microsoft.com/en-us/library/ms190665(v=sql.100).aspx)

SQL Server does not support variable precision decimals. The xs:decimal type represents arbitrary precision decimal numbers. Minimally conforming XML processors must support decimal numbers with a minimum of totalDigits=18. SQL Server supports totalDigits=38, but limits the fractional digits to 10. All xs:decimal instanced values are represented internally by the server by using the SQL type numeric (38, 10).

They map xs:decimal not to numeric type, but decimal

Upvotes: 2

Related Questions