Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Getting records created in a particular week


Getting records created in a particular week

Author
Message
Ramesh Saive
Ramesh Saive
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2564 Visits: 2643
It would be better, if you could post your code with the results you want, rather we working blindly thinking something elseCool

--Ramesh


Keith Hoffman
Keith Hoffman
Grasshopper
Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)

Group: General Forum Members
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
Andras Belokosztolszki
Andras Belokosztolszki
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1385 Visits: 1585
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 Smile You can access this on http://www.sqlservercentral.com/articles/Best+Practices/61537/

Regards,
Andras



Andras Belokosztolszki, MCPD, PhD
GoldenGate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search