{"id":93,"date":"2018-06-01T18:00:08","date_gmt":"2018-06-01T18:00:08","guid":{"rendered":"https:\/\/datablog.roman-halliday.com\/?p=93"},"modified":"2018-06-17T11:50:53","modified_gmt":"2018-06-17T11:50:53","slug":"dates-in-sql-server-create-sample-date-ranges","status":"publish","type":"post","link":"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/","title":{"rendered":"Dates In SQL Server: Create Sample Date Ranges"},"content":{"rendered":"<p>A data set of continuous dates is useful for cursors and creating date tables. Here I look at ways to produce a list of dates.<\/p>\n<p>Continuing my series of posts about dates, I wanted to post something which feeds into lots of examples and testing cases I use day to day in development. I&#8217;ll also be using this technique for some of my later demos. For something a little more introductory, have a look at my article:\u00a0<a href=\"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/05\/01\/dates-in-sql-server-managing-manipulating-dates\/\">Dates In SQL Server: Managing &amp;#038; Manipulating Dates<\/a><\/p>\n<p>Once you have the date range you desire, the output can go into a table. I&#8217;ll award bonus points if you put a primary key on the output table, using the date. The challenge is creating a set of rows, and then modifying a start date using that set.<\/p>\n<h1>Creating dates from a table<\/h1>\n<p>The simplest method is to take a starting date and manipulate it using the row number from a table. This way each row adds an extra number of days to the starting day than the row before it.<\/p>\n<p>In this example I&#8217;m using <code>sys.objects<\/code>, but any large table can be used.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">--------------------------------------------------------------------------------\r\n-- Custom Date Range\r\n--------------------------------------------------------------------------------\r\nDECLARE @DateStart DATE = GetDate();\r\nDECLARE @DateEnd   DATE = GetDate() + 3;\r\n \r\n\/*\r\nDECLARE @DateStart DATE = '01-JAN-14';\r\nDECLARE @DateEnd   DATE = '01-JAN-19'; -- At time of writing this is the future\r\n*\/\r\n \r\nPRINT 'Start Date: ' + CONVERT(VARCHAR(10), @DateStart, 120);\r\nPRINT 'Start End: '  + CONVERT(VARCHAR(10), @DateEnd,   120);\r\n \r\nWITH date_list AS (\r\nSELECT DateAdd(DAY,\r\n               -1 + ROW_NUMBER() OVER (ORDER BY (SELECT 1)),\r\n               @DateStart\r\n              ) AS TheDate\r\n  FROM sys.all_objects\r\n)\r\nSELECT CAST(TheDate AS DATE) AS TheDate\r\n  FROM date_list\r\n WHERE CAST(TheDate AS DATE)\r\n        BETWEEN @DateStart\r\n            AND @DateEnd\r\n ORDER BY TheDate\r\n;<\/pre>\n\n<table id=\"tablepress-1\" class=\"tablepress tablepress-id-1\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">TheDate<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">2014-01-01<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">2014-01-02<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">2014-01-03<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">2014-01-04<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">...<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-1 from cache -->\n<p><strong>Note:<\/strong> The number of days that you can get in your date range is limited by the number of rows in the table you use. Pick a big one if you need to create a very large date range.<\/p>\n<p><strong>Note:<\/strong> The logic above didn&#8217;t work in SQL Fiddle when I tried it. It did work in SSMS.<\/p>\n<h2>SQL Fiddle Examples<\/h2>\n<p>Because the logic above didn&#8217;t work in SQL Fiddle, I&#8217;ve created an alternative example. Have a look at this <a href=\"http:\/\/sqlfiddle.com\/#!18\/6d6cc\/1\">SQL Fiddle example<\/a> for a variation useful for SQL Fiddle demos.<\/p>\n<h1>Creating dates from a\u00a0number sequence<\/h1>\n<p>The alternative and more purist method is to use a number sequence. A number sequence is something I think I&#8217;ll come back to in a future post, it&#8217;s a useful way to create dummy data.<\/p>\n<p>One advantage of this method is portability, this method can be used across other DBMS environments with minimal code changes. I regularly move between environments, this approach saves me some time.<\/p>\n<h2>What is a number sequence<\/h2>\n<p>A number sequence can be any series of numbers in a pattern. Here I&#8217;m talking about incrementing the number by 1 in each row. In many DBMS environments (SQL Server included) there is a row number metadata attribute which takes care of this. This method gives developers the opportunity to create rows from no existing data, and apply calculations to manipulate values.<\/p>\n<p>For this sequence, I create a dataset with numbers 0 &#8211; 9, and then cartesian join that dataset to itself <em>n<\/em> times. This will create all numbers between <code>0<\/code> and <code>(10<\/code><sup><code>n<\/code><\/sup><code>)-1<\/code>. So, join the number table <em>3<\/em> times times for <code>0 - 999<\/code>. See the below code example, I&#8217;ve made it deliberately verbose in nature to demonstrate the idea.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">--------------------------------------------------------------------------------\r\n-- Create Nuber Lis\r\n--------------------------------------------------------------------------------\r\nWITH number_tbl AS (\r\nSELECT 0 AS a UNION ALL\r\nSELECT 1 UNION ALL\r\nSELECT 2 UNION ALL\r\nSELECT 3 UNION ALL\r\nSELECT 4 UNION ALL\r\nSELECT 5 UNION ALL\r\nSELECT 6 UNION ALL\r\nSELECT 7 UNION ALL\r\nSELECT 8 UNION ALL\r\nSELECT 9\r\n), number_sequences AS (\r\nSELECT t1.a AS t1a,\r\n       t2.a AS t2a,\r\n       t3.a AS t3a,\r\n       (t3.a + (10 * t2.a) + (100 * t1.a)) AS concatenate_calculation\r\n  FROM number_tbl t1\r\n  CROSS JOIN number_tbl t2\r\n  CROSS JOIN number_tbl t3\r\n)\r\nSELECT *\r\n  FROM number_sequences\r\n ORDER BY concatenate_calculation\r\n;<\/pre>\n<h2>Using the number sequence<\/h2>\n<p>Like with the &#8220;big table&#8221; idea, we use the rows created by the number sequence to manipulate the date. Either the row number (as used from the big table), or the sequence number generated (which I&#8217;ll use here).<\/p>\n<p>The below code takes the number sequence and adds the sequence number to today&#8217;s date, I&#8217;ve put in a comment to show how this can be applied to MySQL to show the near portability of the method.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">--------------------------------------------------------------------------------\r\n-- Create Date list\r\n--------------------------------------------------------------------------------\r\nWITH number_tbl AS (\r\nSELECT 0 AS a UNION ALL\r\nSELECT 1 UNION ALL\r\nSELECT 2 UNION ALL\r\nSELECT 3 UNION ALL\r\nSELECT 4 UNION ALL\r\nSELECT 5 UNION ALL\r\nSELECT 6 UNION ALL\r\nSELECT 7 UNION ALL\r\nSELECT 8 UNION ALL\r\nSELECT 9\r\n), number_sequences AS (\r\nSELECT t1.a AS t1a,\r\n       t2.a AS t2a,\r\n       t3.a AS t3a,\r\n       (t3.a + (10 * t2.a) + (100 * t1.a)) AS concatenate_calculation\r\n  FROM number_tbl t1\r\n  CROSS JOIN number_tbl t2\r\n  CROSS JOIN number_tbl t3\r\n)\r\nSELECT t1a,\r\n       t2a,\r\n       t3a,\r\n       concatenate_calculation,\r\n       CAST(GetDate() AS DATE)                                                 AS todays_date_SQL_Server,\r\n       CAST(DateAdd(DAY, concatenate_calculation, GetDate()) AS DATE)          AS\u00a0calculated_date_range_SQL_Server,\r\n     \/*CURDATE()                                                               AS todays_date_MySQL,\r\n       CAST(Date_Add(CURDATE(), INTERVAL concatenate_calculation DAY) AS DATE) AS calculated_date_range_MySQL *\/\r\n  FROM number_sequences\r\n ORDER BY concatenate_calculation\r\n;<\/pre>\n<h2>Examples<\/h2>\n<p>I&#8217;ve put a couple of examples together as this is useful for many other cases where a developer might want to create a date sequence or range of rows dynamically:<\/p>\n<ul>\n<li><a href=\"http:\/\/rextester.com\/FZSJIS58622\">Create Date list &#8211; SQL Server<\/a><\/li>\n<li><a href=\"http:\/\/rextester.com\/SMF10985\">Create Date list &#8211; Oracle<\/a><\/li>\n<\/ul>\n<h3>Custom date list in SQL Server<\/h3>\n<p>This code takes a variable start and end date, note that for more than 999 days, extra CROSS JOIN links (and sequence number calculation) changes will be required.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">--------------------------------------------------------------------------------\r\n-- Custom Date Range\r\n-- Using Number sequence\r\n-- Note that this limits us to 999 days\r\n-- To add more days extend the CROSS JOIN\r\n--------------------------------------------------------------------------------\r\n\r\nDECLARE @DateStart DATE = '01-JAN-17'; -- At time of writing this is the past\r\nDECLARE @DateEnd   DATE = '01-JAN-19'; -- At time of writing this is the future\r\n \r\nPRINT 'Start Date: ' + CONVERT(VARCHAR(10), @DateStart, 120);\r\nPRINT 'Start End: '  + CONVERT(VARCHAR(10), @DateEnd,   120);\r\n\r\nWITH number_tbl AS (\r\nSELECT 0 AS a UNION ALL\r\nSELECT 1 UNION ALL\r\nSELECT 2 UNION ALL\r\nSELECT 3 UNION ALL\r\nSELECT 4 UNION ALL\r\nSELECT 5 UNION ALL\r\nSELECT 6 UNION ALL\r\nSELECT 7 UNION ALL\r\nSELECT 8 UNION ALL\r\nSELECT 9\r\n), number_sequences AS (\r\nSELECT t1.a AS t1a,\r\n       t2.a AS t2a,\r\n       t3.a AS t3a,\r\n       (t3.a + (10 * t2.a) + (100 * t1.a)) AS concatenate_calculation\r\n  FROM number_tbl t1\r\n  CROSS JOIN number_tbl t2\r\n  CROSS JOIN number_tbl t3\r\n)\r\nSELECT CAST(DateAdd(DAY, concatenate_calculation, @DateStart) AS DATE) AS [TheDate]\r\n  FROM number_sequences\r\n WHERE CAST(DateAdd(DAY, concatenate_calculation, @DateStart) AS DATE) &lt;= @DateEnd\r\n ORDER BY concatenate_calculation\r\n;<\/pre>\n<p>See it in action over at\u00a0<a href=\"http:\/\/rextester.com\/SGMH21951\">rextester.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A data set of continuous dates is useful for cursors and creating date tables. Here I look at ways to produce a list of dates. Continuing my series of posts about dates, I wanted to post something which feeds into lots of examples and testing cases I use day to day in development. I&#8217;ll also&hellip;<\/p>\n<p class=\"read-more\"><a class=\"readmore-btn\" href=\"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/\">Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,14,4],"tags":[12,16],"class_list":["post-93","post","type-post","status-publish","format-standard","hentry","category-databases","category-sample-data","category-sql-server","tag-date","tag-number-sequence"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Dates In SQL Server: Create Sample Date Ranges - Rows Across The Lake<\/title>\n<meta name=\"description\" content=\"When creating\u00a0dates for testing, cursors or to feed into a date table. The simplest way to get a continuous list of days is to take a starting date and manipulate it using the row number from a table.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dates In SQL Server: Create Sample Date Ranges - Rows Across The Lake\" \/>\n<meta property=\"og:description\" content=\"When creating\u00a0dates for testing, cursors or to feed into a date table. The simplest way to get a continuous list of days is to take a starting date and manipulate it using the row number from a table.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/\" \/>\n<meta property=\"og:site_name\" content=\"Rows Across The Lake\" \/>\n<meta property=\"article:published_time\" content=\"2018-06-01T18:00:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-06-17T11:50:53+00:00\" \/>\n<meta name=\"author\" content=\"david\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@d_roman_h\" \/>\n<meta name=\"twitter:site\" content=\"@d_roman_h\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"david\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2018\\\/06\\\/01\\\/dates-in-sql-server-create-sample-date-ranges\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2018\\\/06\\\/01\\\/dates-in-sql-server-create-sample-date-ranges\\\/\"},\"author\":{\"name\":\"david\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#\\\/schema\\\/person\\\/575f96d2590c3085923ff9e1b565748b\"},\"headline\":\"Dates In SQL Server: Create Sample Date Ranges\",\"datePublished\":\"2018-06-01T18:00:08+00:00\",\"dateModified\":\"2018-06-17T11:50:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2018\\\/06\\\/01\\\/dates-in-sql-server-create-sample-date-ranges\\\/\"},\"wordCount\":654,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#\\\/schema\\\/person\\\/575f96d2590c3085923ff9e1b565748b\"},\"keywords\":[\"date\",\"number sequence\"],\"articleSection\":[\"Databases\",\"Sample Data\",\"SQL Server\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2018\\\/06\\\/01\\\/dates-in-sql-server-create-sample-date-ranges\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2018\\\/06\\\/01\\\/dates-in-sql-server-create-sample-date-ranges\\\/\",\"url\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2018\\\/06\\\/01\\\/dates-in-sql-server-create-sample-date-ranges\\\/\",\"name\":\"Dates In SQL Server: Create Sample Date Ranges - Rows Across The Lake\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#website\"},\"datePublished\":\"2018-06-01T18:00:08+00:00\",\"dateModified\":\"2018-06-17T11:50:53+00:00\",\"description\":\"When creating\u00a0dates for testing, cursors or to feed into a date table. The simplest way to get a continuous list of days is to take a starting date and manipulate it using the row number from a table.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2018\\\/06\\\/01\\\/dates-in-sql-server-create-sample-date-ranges\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2018\\\/06\\\/01\\\/dates-in-sql-server-create-sample-date-ranges\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/index.php\\\/2018\\\/06\\\/01\\\/dates-in-sql-server-create-sample-date-ranges\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Dates In SQL Server: Create Sample Date Ranges\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#website\",\"url\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/\",\"name\":\"Rows Across The Lake\",\"description\":\"Data &amp; Databases\",\"publisher\":{\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#\\\/schema\\\/person\\\/575f96d2590c3085923ff9e1b565748b\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/datablog.roman-halliday.com\\\/#\\\/schema\\\/person\\\/575f96d2590c3085923ff9e1b565748b\",\"name\":\"david\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g\",\"caption\":\"david\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Dates In SQL Server: Create Sample Date Ranges - Rows Across The Lake","description":"When creating\u00a0dates for testing, cursors or to feed into a date table. The simplest way to get a continuous list of days is to take a starting date and manipulate it using the row number from a table.","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:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/","og_locale":"en_GB","og_type":"article","og_title":"Dates In SQL Server: Create Sample Date Ranges - Rows Across The Lake","og_description":"When creating\u00a0dates for testing, cursors or to feed into a date table. The simplest way to get a continuous list of days is to take a starting date and manipulate it using the row number from a table.","og_url":"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/","og_site_name":"Rows Across The Lake","article_published_time":"2018-06-01T18:00:08+00:00","article_modified_time":"2018-06-17T11:50:53+00:00","author":"david","twitter_card":"summary_large_image","twitter_creator":"@d_roman_h","twitter_site":"@d_roman_h","twitter_misc":{"Written by":"david","Estimated reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/#article","isPartOf":{"@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/"},"author":{"name":"david","@id":"https:\/\/datablog.roman-halliday.com\/#\/schema\/person\/575f96d2590c3085923ff9e1b565748b"},"headline":"Dates In SQL Server: Create Sample Date Ranges","datePublished":"2018-06-01T18:00:08+00:00","dateModified":"2018-06-17T11:50:53+00:00","mainEntityOfPage":{"@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/"},"wordCount":654,"commentCount":3,"publisher":{"@id":"https:\/\/datablog.roman-halliday.com\/#\/schema\/person\/575f96d2590c3085923ff9e1b565748b"},"keywords":["date","number sequence"],"articleSection":["Databases","Sample Data","SQL Server"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/","url":"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/","name":"Dates In SQL Server: Create Sample Date Ranges - Rows Across The Lake","isPartOf":{"@id":"https:\/\/datablog.roman-halliday.com\/#website"},"datePublished":"2018-06-01T18:00:08+00:00","dateModified":"2018-06-17T11:50:53+00:00","description":"When creating\u00a0dates for testing, cursors or to feed into a date table. The simplest way to get a continuous list of days is to take a starting date and manipulate it using the row number from a table.","breadcrumb":{"@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/datablog.roman-halliday.com\/index.php\/2018\/06\/01\/dates-in-sql-server-create-sample-date-ranges\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/datablog.roman-halliday.com\/"},{"@type":"ListItem","position":2,"name":"Dates In SQL Server: Create Sample Date Ranges"}]},{"@type":"WebSite","@id":"https:\/\/datablog.roman-halliday.com\/#website","url":"https:\/\/datablog.roman-halliday.com\/","name":"Rows Across The Lake","description":"Data &amp; Databases","publisher":{"@id":"https:\/\/datablog.roman-halliday.com\/#\/schema\/person\/575f96d2590c3085923ff9e1b565748b"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/datablog.roman-halliday.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/datablog.roman-halliday.com\/#\/schema\/person\/575f96d2590c3085923ff9e1b565748b","name":"david","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g","caption":"david"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/acddbc676a1d5c73795edcf0627ee39e5aa947da9033b58373e03d93122cb3b7?s=96&d=mm&r=g"}}]}},"_links":{"self":[{"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/posts\/93","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/comments?post=93"}],"version-history":[{"count":9,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/posts\/93\/revisions"}],"predecessor-version":[{"id":125,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/posts\/93\/revisions\/125"}],"wp:attachment":[{"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/media?parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/categories?post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datablog.roman-halliday.com\/index.php\/wp-json\/wp\/v2\/tags?post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}