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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 begin date and end of date of month

Author  Topic 

djokerss
Starting Member

28 Posts

Posted - 2004-12-28 : 21:43:04

how do we know total days of month, like
this month total days is 31, january 31 etc

i need it to know the first date of this month is 1
and the last date is 31 ( begin date and end of date of month )

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-28 : 22:11:11
well the first day of the month is always the first.

select dateadd(dd,-1,dateadd(mm,1,convert(varchar(6),getdate(),112) + '01'))
will give the last day
select datepart(dd,dateadd(dd,-1,dateadd(mm,1,convert(varchar(6),getdate(),112) + '01')))
the no of days


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

djokerss
Starting Member

28 Posts

Posted - 2004-12-28 : 22:36:45
thanks....thats what i need
Go to Top of Page
   

- Advertisement -