Hi,
I want to display days in a particular month.
following query displays that in 30 days .my requirement is to display from 1 to 15 and 15 to 30 or 31.
this is my query
declare @dte as datetime ='2013-07-15'
--declare @dte as datetime
--declare @tdate as datetime ='2013-07-01'
declare @StDt as Datetime = DATEADD(dd,-(DAY(GETDATE())-1),@dte)
declare @EnDt as datetime = DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@dte)+1,0))
Declare @Cnt as int = datepart(dd,@EnDt)
Declare @inc as int = 0
Create table #temp (Month_date datetime)
while @inc < @cnt
begin
insert into #temp
select DATEADD(dd, @inc, DATEADD(dd,-(DAY(@dte)-1),@dte))
set @inc = @inc + 1
end
select * from #temp
drop table #temp
how to solve it.
Regards
Baiju