Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-03-11 : 00:42:18
|
| hemant writes "Hi,i want to display all date and day in on month.rgd,hemant" |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-03-11 : 02:43:13
|
| you can try on these lines create procedure monthdates (@mDate datetime)asset nocount ondeclare @no intdeclare @year intdeclare @month intdeclare @noofdays intset @no=1set @year=datepart(yyyy,@mdate)set @month=datepart(mm,@mdate)set @mdate=@mdate-datepart(dd,convert(datetime,@mdate+@no,121))+1if @month=2begin if @year%4 =0 set @noofdays=29 else set @noofdays=28endelse if @month in (1,3,5,7,8,10,12) set @noofdays=31else begin set @noofdays=30 print 'test' endcreate table #tempd( mdate datetime)while @no <= @noofdaysbegin insert into #tempd select convert(datetime,@mdate+@no,121) set @no=@no+1 endselect * from #tempddrop table #tempdgoexec monthdates '11-dec-2002' -------------------------------------------------------------- |
 |
|
|
|
|
|
|
|