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)
 dispalying data by day, week and month

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-02-21 : 07:50:00
Gary writes "Hello

I need some help with writing a stored proc that will display data on a given day, week and month.

For example, i have a simple table and one of the columns has a create date field. i need to be able to show data for that day, ie, if its monday, i need to show only data for Monday, if its tuesday i need to show only data for that day.

The same goes for the week. whatever week are are in, i need to only show data for this week, nothing from previous weeks.

The same goes for the month of the current year. If its february i need to show data created in february of the current year etc...

Thanks

Gary"

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2007-02-21 : 07:59:40
Look at the DATEPART and DATENAME functions in Books Online.

Mark
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-21 : 08:20:10
Your business need to define what a week is, too.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -