{"id":779,"date":"2007-08-02T22:51:00","date_gmt":"2007-08-02T22:51:00","guid":{"rendered":"\/blogs\/bobb\/post\/New-SQL-Server-2008-DateTime-related-types-and-ADONET.aspx"},"modified":"2007-08-02T22:51:00","modified_gmt":"2007-08-02T22:51:00","slug":"new-sql-server-2008-datetime-related-types-and-ado-net","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/","title":{"rendered":"New SQL Server 2008 Date\/Time-related types and ADO.NET"},"content":{"rendered":"<p>\nI&#39;ve been looking at the mapping of the new Katmai date\/time data types to .NET types, both from the point of view of SQL Server ADO.NET clients and of SQLCLR procedures\/functions\/triggers. There are a couple of things that &quot;interesting&quot;, if I&#39;m not misunderstanding something obvious.\n<\/p>\n<p>\nThere are no new System.Data.SqlTypes to correspond to the new SQL Server data types. The beta Visual Studio docs state this as a fact. So, unless SQLCLR supports the generic Nullable types as parameters in Katmai, you&#39;ll pass these in and out as strings. Or only use them in UDFs with RETURNS NULL ON NULL INPUT. No word yet (that I&#39;m aware of)&nbsp;on Nullable type support in SQL Server 2008, BUT the new HierarchyID type (which is .NET based) supports INullable, like SqlTypes do. So I can pass in a NULL HierarchyID to SQLCLR, but not a NULL TIME parameter.\n<\/p>\n<p>\nSQL Server&#39;s TIME data type is mapped to TimeSpan, which is a time interval. data type. This might confuse folks that know SQL Server doesn&#39;t support SQL-99&#39;s date\/time interval data types. But the TimeSpan seems to have appropriate semantics as long as you stay away from the &quot;Days&quot; related properties and methods.\n<\/p>\n<p>\nThere is a new .NET data type for DATETIMEOFFSET, System.DateTimeOffset. That&#39;s good.\n<\/p>\n<p>\nTo distinguish between SQL Server 2000\/2005\/2008 usage\/mappings, there is a (client-side) connection string parameter: &quot;Type System Version&quot;. You have a choice of 2008, 2005, 2000, or &quot;Latest&quot;. This was already used in SQL Server 2005 to distinguish between 2005 (XML data type exists) vs 2000 (XML data type is a long string). And other distinctions.\n<\/p>\n<p>\nI wonder if LINQ for SQL&nbsp;and Entity Framework will support these&#8230; \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#39;ve been looking at the mapping of the new Katmai date\/time data types to .NET types, both from the point of view of SQL Server ADO.NET clients and of SQLCLR procedures\/functions\/triggers. There are a couple of things that &quot;interesting&quot;, if I&#39;m not misunderstanding something obvious. There are no new System.Data.SqlTypes to correspond to the new [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,40],"tags":[],"class_list":["post-779","post","type-post","status-publish","format-standard","hentry","category-data-access","category-sql-server-2008","category-transact-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>New SQL Server 2008 Date\/Time-related types and ADO.NET - Bob Beauchemin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"New SQL Server 2008 Date\/Time-related types and ADO.NET - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve been looking at the mapping of the new Katmai date\/time data types to .NET types, both from the point of view of SQL Server ADO.NET clients and of SQLCLR procedures\/functions\/triggers. There are a couple of things that &quot;interesting&quot;, if I&#039;m not misunderstanding something obvious. There are no new System.Data.SqlTypes to correspond to the new [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2007-08-02T22:51:00+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/\",\"name\":\"New SQL Server 2008 Date\/Time-related types and ADO.NET - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2007-08-02T22:51:00+00:00\",\"dateModified\":\"2007-08-02T22:51:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Data Access\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/data-access\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"New SQL Server 2008 Date\/Time-related types and ADO.NET\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"New SQL Server 2008 Date\/Time-related types and ADO.NET - Bob Beauchemin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/","og_locale":"en_US","og_type":"article","og_title":"New SQL Server 2008 Date\/Time-related types and ADO.NET - Bob Beauchemin","og_description":"I&#39;ve been looking at the mapping of the new Katmai date\/time data types to .NET types, both from the point of view of SQL Server ADO.NET clients and of SQLCLR procedures\/functions\/triggers. There are a couple of things that &quot;interesting&quot;, if I&#39;m not misunderstanding something obvious. There are no new System.Data.SqlTypes to correspond to the new [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/","og_site_name":"Bob Beauchemin","article_published_time":"2007-08-02T22:51:00+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/","name":"New SQL Server 2008 Date\/Time-related types and ADO.NET - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2007-08-02T22:51:00+00:00","dateModified":"2007-08-02T22:51:00+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/new-sql-server-2008-datetime-related-types-and-ado-net\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"Data Access","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/data-access\/"},{"@type":"ListItem","position":3,"name":"New SQL Server 2008 Date\/Time-related types and ADO.NET"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=779"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/779\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}