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.
Author |
Topic |
pras2007
Posting Yak Master
216 Posts |
Posted - 2007-04-12 : 16:21:19
|
Hello All, I’ve created a stored procedure that enables my users to enter a “Start date” and an “End Date”, now they want to be able to enter multiple Counts. Does anyone know how to code this stored procedure to accept multiple AGT.COUNT? What I have right now is hard coded values (ex. 90, 92). The code sample is shown below. Please advice. Thanks.Stored procedure:CREATE PROCEDURE usp_Sample@StartDate SMALLDATETIME,@EndDate SMALLDATETIME ASSELECT CONVERT(VARCHAR(12), '01/01/07', 1) AS [Start Date], CONVERT(VARCHAR(12), '01/02/07', 1) AS [End Date], AGT.COUNT, M.MU_NAMEFROM M_UNIT M RIGHT OUTER JOIN S_HEAD SH INNER JOIN AGENT AGT ON SH.AGENT_ID = AGT.ID ON M.MU_ID = AGT.MU_IDWHERE (SH.STATUS = 'A') AND (SH.[DATE] BETWEEN '01/01/07' AND DATEADD(d, 1, '01/02/07')) AND (AGT.COUNT IN (N'90', N'92'))GROUP BY SH.[DATE], AGT.MU_ID, M.MU_NAMEORDER BY SH.[DATE], AGT.MU_IDGO |
|
|
|
|
|
|