{"id":497,"date":"2015-07-03T18:23:35","date_gmt":"2015-07-03T12:53:35","guid":{"rendered":"http:\/\/mairwa.com\/wordpress\/?p=497"},"modified":"2015-07-03T18:23:35","modified_gmt":"2015-07-03T12:53:35","slug":"sql-server-data-type-mappings","status":"publish","type":"post","link":"http:\/\/mairwa.com\/wordpress\/?p=497","title":{"rendered":"SQL Server Data Type Mappings"},"content":{"rendered":"<p>&nbsp;<\/p>\n<table width=\"852\">\n<tbody>\n<tr>\n<td><strong>SQL Server Database Engine type<\/strong><\/td>\n<td><strong>.NET Framework type<\/strong><\/td>\n<td><strong>SqlDbType enumeration<\/strong><\/td>\n<td><strong>SqlDataReader SqlTypes typed accessor<\/strong><\/td>\n<td><strong>DbType enumeration<\/strong><\/td>\n<td><strong>SqlDataReader DbType typed accessor<\/strong><\/td>\n<\/tr>\n<tr>\n<td>bigint<\/td>\n<td>Int64<\/td>\n<td>BigInt<\/td>\n<td>GetSqlInt64<\/td>\n<td>Int64<\/td>\n<td>GetInt64<\/td>\n<\/tr>\n<tr>\n<td>binary<\/td>\n<td>Byte[]<\/td>\n<td>VarBinary<\/td>\n<td>GetSqlBinary<\/td>\n<td>Binary<\/td>\n<td>GetBytes<\/td>\n<\/tr>\n<tr>\n<td>bit<\/td>\n<td>Boolean<\/td>\n<td>Bit<\/td>\n<td>GetSqlBoolean<\/td>\n<td>Boolean<\/td>\n<td>GetBoolean<\/td>\n<\/tr>\n<tr>\n<td>char<\/td>\n<td>String<\/p>\n<p>Char[]<\/td>\n<td>Char<\/td>\n<td>GetSqlString<\/td>\n<td>AnsiStringFixedLength,<\/p>\n<p>String<\/td>\n<td>GetString<\/p>\n<p>GetChars<\/td>\n<\/tr>\n<tr>\n<td>date<\/p>\n<p>(SQL Server 2008 and later)<\/td>\n<td>DateTime<\/td>\n<td>Date<\/td>\n<td>GetSqlDateTime<\/td>\n<td>Date<\/td>\n<td>GetDateTime<\/td>\n<\/tr>\n<tr>\n<td>datetime<\/td>\n<td>DateTime<\/td>\n<td>DateTime<\/td>\n<td>GetSqlDateTime<\/td>\n<td>DateTime<\/td>\n<td>GetDateTime<\/td>\n<\/tr>\n<tr>\n<td>datetime2<\/p>\n<p>(SQL Server 2008 and later)<\/td>\n<td>DateTime<\/td>\n<td>DateTime2<\/td>\n<td>None<\/td>\n<td>DateTime2<\/td>\n<td>GetDateTime<\/td>\n<\/tr>\n<tr>\n<td>datetimeoffset<\/p>\n<p>(SQL Server 2008 and later)<\/td>\n<td>DateTimeOffset<\/td>\n<td>DateTimeOffset<\/td>\n<td>none<\/td>\n<td>DateTimeOffset<\/td>\n<td>GetDateTimeOffset<\/td>\n<\/tr>\n<tr>\n<td>decimal<\/td>\n<td>Decimal<\/td>\n<td>Decimal<\/td>\n<td>GetSqlDecimal<\/td>\n<td>Decimal<\/td>\n<td>GetDecimal<\/td>\n<\/tr>\n<tr>\n<td>FILESTREAM attribute (varbinary(max))<\/td>\n<td>Byte[]<\/td>\n<td>VarBinary<\/td>\n<td>GetSqlBytes<\/td>\n<td>Binary<\/td>\n<td>GetBytes<\/td>\n<\/tr>\n<tr>\n<td>float<\/td>\n<td>Double<\/td>\n<td>Float<\/td>\n<td>GetSqlDouble<\/td>\n<td>Double<\/td>\n<td>GetDouble<\/td>\n<\/tr>\n<tr>\n<td>image<\/td>\n<td>Byte[]<\/td>\n<td>Binary<\/td>\n<td>GetSqlBinary<\/td>\n<td>Binary<\/td>\n<td>GetBytes<\/td>\n<\/tr>\n<tr>\n<td>int<\/td>\n<td>Int32<\/td>\n<td>Int<\/td>\n<td>GetSqlInt32<\/td>\n<td>Int32<\/td>\n<td>GetInt32<\/td>\n<\/tr>\n<tr>\n<td>money<\/td>\n<td>Decimal<\/td>\n<td>Money<\/td>\n<td>GetSqlMoney<\/td>\n<td>Decimal<\/td>\n<td>GetDecimal<\/td>\n<\/tr>\n<tr>\n<td>nchar<\/td>\n<td>String<\/p>\n<p>Char[]<\/td>\n<td>NChar<\/td>\n<td>GetSqlString<\/td>\n<td>StringFixedLength<\/td>\n<td>GetString<\/p>\n<p>GetChars<\/td>\n<\/tr>\n<tr>\n<td>ntext<\/td>\n<td>String<\/p>\n<p>Char[]<\/td>\n<td>NText<\/td>\n<td>GetSqlString<\/td>\n<td>String<\/td>\n<td>GetString<\/p>\n<p>GetChars<\/td>\n<\/tr>\n<tr>\n<td>numeric<\/td>\n<td>Decimal<\/td>\n<td>Decimal<\/td>\n<td>GetSqlDecimal<\/td>\n<td>Decimal<\/td>\n<td>GetDecimal<\/td>\n<\/tr>\n<tr>\n<td>nvarchar<\/td>\n<td>String<\/p>\n<p>Char[]<\/td>\n<td>NVarChar<\/td>\n<td>GetSqlString<\/td>\n<td>String<\/td>\n<td>GetString<\/p>\n<p>GetChars<\/td>\n<\/tr>\n<tr>\n<td>real<\/td>\n<td>Single<\/td>\n<td>Real<\/td>\n<td>GetSqlSingle<\/td>\n<td>Single<\/td>\n<td>GetFloat<\/td>\n<\/tr>\n<tr>\n<td>rowversion<\/td>\n<td>Byte[]<\/td>\n<td>Timestamp<\/td>\n<td>GetSqlBinary<\/td>\n<td>Binary<\/td>\n<td>GetBytes<\/td>\n<\/tr>\n<tr>\n<td>smalldatetime<\/td>\n<td>DateTime<\/td>\n<td>DateTime<\/td>\n<td>GetSqlDateTime<\/td>\n<td>DateTime<\/td>\n<td>GetDateTime<\/td>\n<\/tr>\n<tr>\n<td>smallint<\/td>\n<td>Int16<\/td>\n<td>SmallInt<\/td>\n<td>GetSqlInt16<\/td>\n<td>Int16<\/td>\n<td>GetInt16<\/td>\n<\/tr>\n<tr>\n<td>smallmoney<\/td>\n<td>Decimal<\/td>\n<td>SmallMoney<\/td>\n<td>GetSqlMoney<\/td>\n<td>Decimal<\/td>\n<td>GetDecimal<\/td>\n<\/tr>\n<tr>\n<td>sql_variant<\/td>\n<td>Object *<\/td>\n<td>Variant<\/td>\n<td>GetSqlValue\u00a0*<\/td>\n<td>Object<\/td>\n<td>GetValue\u00a0*<\/td>\n<\/tr>\n<tr>\n<td>text<\/td>\n<td>String<\/p>\n<p>Char[]<\/td>\n<td>Text<\/td>\n<td>GetSqlString<\/td>\n<td>String<\/td>\n<td>GetString<\/p>\n<p>GetChars<\/td>\n<\/tr>\n<tr>\n<td>time<\/p>\n<p>(SQL Server 2008 and later)<\/td>\n<td>TimeSpan<\/td>\n<td>Time<\/td>\n<td>none<\/td>\n<td>Time<\/td>\n<td>GetDateTime<\/td>\n<\/tr>\n<tr>\n<td>timestamp<\/td>\n<td>Byte[]<\/td>\n<td>Timestamp<\/td>\n<td>GetSqlBinary<\/td>\n<td>Binary<\/td>\n<td>GetBytes<\/td>\n<\/tr>\n<tr>\n<td>tinyint<\/td>\n<td>Byte<\/td>\n<td>TinyInt<\/td>\n<td>GetSqlByte<\/td>\n<td>Byte<\/td>\n<td>GetByte<\/td>\n<\/tr>\n<tr>\n<td>uniqueidentifier<\/td>\n<td>Guid<\/td>\n<td>UniqueIdentifier<\/td>\n<td>GetSqlGuid<\/td>\n<td>Guid<\/td>\n<td>GetGuid<\/td>\n<\/tr>\n<tr>\n<td>varbinary<\/td>\n<td>Byte[]<\/td>\n<td>VarBinary<\/td>\n<td>GetSqlBinary<\/td>\n<td>Binary<\/td>\n<td>GetBytes<\/td>\n<\/tr>\n<tr>\n<td>varchar<\/td>\n<td>String<\/p>\n<p>Char[]<\/td>\n<td>VarChar<\/td>\n<td>GetSqlString<\/td>\n<td>AnsiString\u00a0,\u00a0String<\/td>\n<td>GetString<\/p>\n<p>GetChars<\/td>\n<\/tr>\n<tr>\n<td>xml<\/td>\n<td>Xml<\/td>\n<td>Xml<\/td>\n<td>GetSqlXml<\/td>\n<td>Xml<\/td>\n<td>none<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>*<\/p>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">&nbsp; SQL Server Database Engine type .NET Framework type SqlDbType enumeration SqlDataReader SqlTypes typed accessor DbType enumeration SqlDataReader DbType typed accessor bigint Int64 BigInt GetSqlInt64 Int64 GetInt64 binary Byte[] VarBinary GetSqlBinary Binary GetBytes bit Boolean Bit GetSqlBoolean Boolean GetBoolean char String Char[] Char GetSqlString AnsiStringFixedLength, String GetString GetChars date (SQL Server 2008 and later) DateTime Date GetSqlDateTime Date GetDateTime datetime&hellip; <a href=\"http:\/\/mairwa.com\/wordpress\/?p=497\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,14],"tags":[],"class_list":["post-497","post","type-post","status-publish","format-standard","hentry","category-c-vb","category-sql-server","xfolkentry"],"_links":{"self":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=497"}],"version-history":[{"count":1,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/497\/revisions"}],"predecessor-version":[{"id":498,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/497\/revisions\/498"}],"wp:attachment":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=497"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}