MS SQL Server
When an XML Schema is generated from an MS SQL Server database (DB), the MS SQL Server DB datatypes are converted to XML Schema datatypes as listed in the table below.
XML Schema Datatype | MS SQL Server Datatype |
ID | uniqueidentifier |
xs:string | If no facets { if UNICODE nvarchar (255) else varchar (255) } else { if UNICODE (Size = either length or maxLength) If Size <= 4000 if FacetLengthIsSet then nChar else nVarChar if Size <= 1073741823 then nText } else { if NON-UNICODE (Size = either length or maxLength) If Size <= 8000 if FacetLengthIsSet then char else varchar if Size <= 2147483647 then text } |
xs:normalizedString | Same as xs:string |
xs:token | Same as xs:string |
xs:Name | Same as xs:string |
xs:NCName | Same as xs:string |
xs:anyURi | Same as xs:string |
xs:QName | Same as xs:string |
xs:NOTATION | Same as xs:string |
xs:boolean | bit |
xs:float | real |
xs:double | float |
xs:decimal | decimal |
xs:duration | datetime |
xs:dateTime | datetime |
xs:time | datetime |
xs:date | datetime |
xs:gYearMonth | datetime |
xs:gYear | datetime |
xs:gMonthDay | datetime |
xs:gDay | datetime |
xs:gMonth | datetime |
xs:hexBinary | If no facets varbinary (255) (Size = either length or maxLength If Size <= 8000 if FacetLengthIsSet then binary else varbinary if Size <= 2147483647 then image |
xs:base64Binary | Same as xs:hexBinary |
xs:integer | int |
xs:int | int |
xs:negativeInteger | Int (constrained to {...,-2,-1}) |
xs:positiveInteger | Int (constrained to {1,2,...}) |
xs:nonNegativeInteger | int (constrained to {0,1,2,...}) |
xs:nonPositiveInteger | int (constrained to {...,-2,-1,0}) |
xs:unsignedInt | int (additional constraints) |
xs:short | smallint |
xs:unsignedShort | smallint (additional constraints) |
xs:long | bigint |
xs:unsignedLong | bigint (additional constraints) |
xs:byte | tinyint |
xs:unsignedByte | tinyint (additional constraints) |