Daily/Weekly/Monthly Record Count Search via StoredProcedure

Posted by user270960 on Stack Overflow See other posts from Stack Overflow or by user270960
Published on 2010-03-16T08:42:39Z Indexed on 2010/03/16 8:46 UTC
Read the original article Hit count: 304

Filed under:
|
|
|
|

Using MS SQL Server.I have made a Stored Procedure naming "SP_Get_CallsLogged".

I have a table named "TRN_Call", and it has one column named "CallTime" which is a DateTime.

I have a web-page in my application where the User enters:-

1.StartDate (DateTime)

2.EndDate (DateTime)

3.Period(Daily/Weekly/Monthly) (varchar) (from DropDownList)

I want to get the Record Count of those calls in my table *TRN_Call* on the basis of the specified Period(Daily/Weekly/Monthly) selected by user in the DropDownList.

e.g. StartDate ='1/18/2010 11:10:46 AM' EndDate ='1/25/2010 01:10:46 AM' Period =Daily

So the record count between these above mentioned dates(StartDate+EndDate) should come in a manner so that I can refer to those counts separately i.e. the following:-

Date 1/18/2010 Records Found 5

Date 1/19/2010 Records Found 50

Date 1/20/2010 Records Found 15

Date 1/21/2010 Records Found 32

Date 1/22/2010 Records Found 12

Date 1/23/2010 Records Found 15

Date 1/24/2010 Records Found 17

Date 1/25/2010 Records Found 32

and send those Counts to the Web Application so that these counts could be listed then in the Crystal Reports.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server