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 |
|
SQLCode
Posting Yak Master
143 Posts |
Posted - 2004-04-21 : 10:14:00
|
| Hello all,Problem:When I am calling the proc from web interface I am gettting errors like Object could not be opened.When I hard code the date values, it works just fine. Some of the things I tried1) convert function for each date variable when I am passing it to the query like between convert( smalldatetime,@ThreeMonthStart) and convert( smalldatetime,@ThreeMonthEnd) 2)hard coded date in one place with 'set' and calculate the rest.Nothing seems to work. May be all my ideas are wrong and I do not want to hard code. Pls. help.stored proc as follows:CREATE PROC spTest @ThreeMonthStart smalldatetime, @Type Char(50)asDeclare @ThreeMonthStart smalldatetime, @ThreeMonthEnd SmallDatetime ,@MonthlyStart SmallDatetime ,@MonthlyEnd SmallDatetimeSET @ThreeMonthStart =convert (smalldatetime,'11/01/2003')SET @ThreeMonthEnd=DATEADD(d,-1,DATEADD(m,3,@ThreeMonthStart))SET @MonthlyStart=DATEADD(d,1,@ThreeMonthEnd)SET @MonthlyEnd=DATEADD(d,-1,DATEADD(m,1,@MonthlyStart))SELECT m.Monthly,tm.ThreeMonAvg, tm.nameFROM (SELECT count(SCount)/3 as threeMonAvg, name,descriptionfrom Iwhere SStartDate between @ThreeMonthStart and @ThreeMonthEnd -- '11/01/2003' and '01/31/2004'group by i.name,i.description ) as tmJOIN (select count(SCount) as Monthly, name,descriptionfrom Iwhere SStartDate between @MonthlyStart and @MonthlyEnd -- '02/01/2004' and '02/29/2004' --@MonthlyEndgroup by i.name,i.description ) as mON tm.Name=m.Nameand tm.Description=m.Descriptionand tm.Description=@MediaType GO |
|
|
SQLCode
Posting Yak Master
143 Posts |
Posted - 2004-04-21 : 13:34:10
|
| Never mind guys, I found the problem.I had one my debugging print statements in the procedure.Thanks to all who read. |
 |
|
|
|
|
|
|
|