Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Getting records created in a particular week Expand / Collapse
Author
Message
Posted Monday, December 03, 2007 10:53 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, October 21, 2013 12:32 AM
Points: 2,556, Visits: 2,593
It would be better, if you could post your code with the results you want, rather we working blindly thinking something else



--Ramesh

Post #429102
Posted Tuesday, December 04, 2007 2:06 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, March 04, 2011 12:12 PM
Points: 14, Visits: 63
Assuming more things than I care to list, a strored procedure might look like...

create procedure getThatWeek
(@inputDate datetime)
as
begin
set @inputDate = convert(varchar(10), @inputDate, 111)
select left(datename(dw,createdate),3) as ThatDay ,NumOfRequests
from YourRequestLogTable
where createdate >= dateadd(dd, 1 - datepart(dw, @inputDate), @inputDate)
and createdate < dateadd(dd, 8 - datepart(dw, @inputDate), @inputDate)
end
Post #429143
Posted Tuesday, December 04, 2007 2:18 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 26, 2012 5:26 AM
Points: 1,367, Visits: 1,585
Prakash (12/3/2007)
Dear All

I want the output in this way

Days No of.Requests
Mon 5
Tue 6
Wed 7
Thu 3
Fri 2
Sat 1

I will pass only the date to the query
Pls help me to solve this problem


Hmm, having misunderstood your original question (and suspecting that I'm not alone), and being curious enough about the problem, I'm wondering if you could explain it in more detail. Jeff Moden has a brilliant guideline about how to describe your question so that you can get a result you are happy with quickly :) You can access this on http://www.sqlservercentral.com/articles/Best+Practices/61537/

Regards,
Andras




Andras Belokosztolszki, MCPD, PhD
GoldenGate Software
Post #429147
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse