且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用sql中的条件动态创建一个月的天数

更新时间:2022-11-13 21:32:49

这个怎么样?

在SQL Server中生成日期表 [ ^ ]

CREATE TABLE employee_active_on_proj
(
    EmpName varchar(50),
    ProjectName varchar(50),
    startofproject datetime,
    EndOfProject datetime
);


And here is one row of data

insert into employee_active_on_proj values('JOhn','Projet 1','03/04/2015','14/04/2015')

insert into employee_active_on_proj values('JOhn','Projet 2','16/04/2015','24/04/2015')



My output should be based on the inputs Month and year using stored procedure



=======================================================================
Empname 01/04/2015 .. 03/04/2015 14/04/2014 .... 31/04/2015

=======================================================================
JOhn N/A ACTIVE Project ends

========================================================================

How about this?
Generate Date Table in SQL Server[^]