Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQL |将多个日期栏拆分为各个日期_Sql_Sql Server 2005 - Fatal编程技术网

SQL |将多个日期栏拆分为各个日期

SQL |将多个日期栏拆分为各个日期,sql,sql-server-2005,Sql,Sql Server 2005,我如何将多个日期栏拆分为单独的日期 因此,从这样的事情: DateStart DateEnd ---------- ---------- 2013-01-01 2013-01-03 2013-01-06 2013-01-08 Date ---------- 2013-01-01 2013-01-02 2013-01-03 2013-01-06 2013-01-07 2013-01-08 对这样的事情: DateStart DateEnd ---------- --------

我如何将多个日期栏拆分为单独的日期

因此,从这样的事情:

DateStart   DateEnd
----------  ----------
2013-01-01  2013-01-03
2013-01-06  2013-01-08
Date
----------
2013-01-01
2013-01-02
2013-01-03
2013-01-06
2013-01-07
2013-01-08
对这样的事情:

DateStart   DateEnd
----------  ----------
2013-01-01  2013-01-03
2013-01-06  2013-01-08
Date
----------
2013-01-01
2013-01-02
2013-01-03
2013-01-06
2013-01-07
2013-01-08

使用交叉连接到您的日历表

WHERE day_of_calendar BETWEEN DateStart and DateEnd
或者切换到Teradata,在那里有一个很好的扩展:-)