473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

output parameters are not returning the values

this is my prcoedure...


Expand|Select|Wrap|Line Numbers
  1. ALTER PROCEDURE test
  2. @fromdate  as varchar(50),
  3. @todate    as varchar(50),
  4. @mailbox   as varchar(25),
  5. @open      as int output,
  6. @close     as int output,
  7. @queue     as int output
  8.  
  9.  
  10. AS
  11. BEGIN  
  12.    IF(@mailbox='HelpDeskOSA')
  13.    BEGIN
  14.                    select @open=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox 
  15.                                                      and cast(@fromdate as datetime)< DateInitiated
  16.                                                      and cast(@todate as datetime)> DateInitiated
  17.  
  18.                    select @close=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox                                                     
  19.                                                      and [Status] in ('complete','canceled')
  20.                                                      and [StatusDate] between cast(@fromdate as datetime)
  21.                                                      and cast(@todate as datetime)
  22.  
  23.                    select @queue=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox 
  24.                                                      and [Status] not in ('complete','canceled')  
  25.                                                      and cast(@fromdate as datetime)< DateInitiated 
  26.                                                      and cast(@todate as datetime)> DateInitiated
  27.  
  28.                                                      END
  29.  
  30.    IF(@mailbox='HelpWebJJ@esi-intl.com')
  31.    BEGIN
  32.                    select @open=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox 
  33.                                                      and cast(@fromdate as datetime)< DateInitiated
  34.                                                      and cast(@todate as datetime)> DateInitiated
  35.  
  36.                    select @close=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox                                                     
  37.                                                      and [Status] in ('complete','canceled')
  38.                                                      and [StatusDate] between cast(@fromdate as datetime)
  39.                                                      and cast(@todate as datetime)
  40.  
  41.                    select @queue=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox 
  42.                                                      and [Status] not in ('complete','canceled')  
  43.                                                      and cast(@fromdate as datetime)< DateInitiated 
  44.                                                      and cast(@todate as datetime)> DateInitiated 
  45.                                                      END
  46.  
  47.    IF(@mailbox='All')
  48.    BEGIN
  49.  
  50.                    select @open=count(*) from esinet_dbo.HelpDesk1 where Mailbox in ('HelpDeskOSA','HelpWebJJ@esi-intl.com')
  51.                                                      and cast(@fromdate as datetime)< DateInitiated
  52.                                                      and cast(@todate as datetime)> DateInitiated
  53.  
  54.                    select @close=count(*) from esinet_dbo.HelpDesk1 where Mailbox in ('HelpDeskOSA','HelpWebJJ@esi-intl.com')                                                   
  55.                                                      and [Status] in ('complete','canceled')
  56.                                                      and [StatusDate] between cast(@fromdate as datetime)
  57.                                                      and cast(@todate as datetime)
  58.  
  59.                    select @queue=count(*) from esinet_dbo.HelpDesk1 where Mailbox in ('HelpDeskOSA','HelpWebJJ@esi-intl.com')
  60.                                                      and [Status] not in ('complete','canceled')  
  61.                                                      and cast(@fromdate as datetime)< DateInitiated 
  62.                                                      and cast(@todate as datetime)> DateInitiated 
  63.                                                      END
  64.  
  65. return @open 
  66. return @close
  67. return @queue
  68.  
  69.  
  70.  
  71.  
  72. END

thanx in advance.......
Aug 7 '12 #1
7 2111
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

You need to be detailed about your problem. You just have your stored procedure code. That by itself does not return anything. You haven't shown how you're trying to execute it and how you're trying to pull the return values.
Aug 7 '12 #2
Thanx for the reply Mr.Rabbit...I am using 3 out parameters in the procedure..which should return the values based on the mailbox option...how to return the output parameters values?
Aug 8 '12 #3
Rabbit
12,516 Expert Mod 8TB
You still haven't shown me the code that actually runs the stored procedure. That's where you need to make changes to get it to return the output parameters. I can't advise you on how to fix it if you don't show me how you call it.
Aug 8 '12 #4
actually still i am executing the stored procedure by giving proper values...but its returning null...when i run the queries individually in the procedure then i get the values...why the output parameters are not carrying/displaying the actual values..where the queries can...
Aug 9 '12 #5
what i want is just tell me is there anything wrong in my procedure....
Aug 9 '12 #6
Rabbit
12,516 Expert Mod 8TB
I don't see anything wrong with the procedure. As long as your queries are correct. What's most likely wrong is that you're calling it incorrectly. But since you haven't shown how you're calling it, I can't tell you if that's the case.
Aug 9 '12 #7
ck9663
2,878 Expert 2GB
If you are expecting those three returns to be executed, you're probably wrong. The first return will be executed with the variable @open as returned value. Anything after the first return is not executed.

That is not the way you pass the value of the returned variables. It will also depend on the way you call the SP, which you seems unable to share.

We cannot help you fully if there are missing information from your question.

Good Luck!!!


~~ CK
Aug 9 '12 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Steve Holden | last post by:
Has anyone, with any driver whatsoever, managed to retrieve output parameters from a SQL Server stored procedure? I've just been rather embarrassed to find out it's not as easy as it might seem,...
1
by: PinkGuava | last post by:
Hi, I have a T-SQL stored procedure that returns both output parameters and a recordset. How do I retrieve them in my ASP script? As far as I know, the ADO Command object can be used to retrieve...
1
by: Bari Allen | last post by:
I have a Stored procedure in SQL, that works, when tested in SQL, with one input & several output parameters, as follows: CREATE PROCEDURE myProcedure @MyID int , @First varchar(80) OUTPUT ,...
5
by: Paul Aspinall | last post by:
Hi I have a Stored Proc in SQL server, which creates a record key when a record is created. I want to return the value back to my code, once the record has been created. I am using SQLHelper...
4
by: Janaka | last post by:
Hi this is kind of an ASP.NET/ADO.NET question. I've got a stored procedure on SQL Server that returns a results set. It also sets 3 output parameters in a seperate Select statement. When...
1
by: Garth Wells | last post by:
Using an example in the Jan 2006 release of the Enterprise Library, I came up with the code shown below to create a DAL method for returning several columns of a single row. I place the output...
0
by: Andy | last post by:
Hi All. I'm working for a company that has set out a guideline for retrieving data from a database. Nobody can explain to me the reason for the following. When retrieving a set of records...
1
by: Richard | last post by:
I have a typed dataset in asp.net 2.0, that returns 2 output parameters. Unfortunately I have not been able to capture these values: Private Sub GetValues() Dim ta As New...
1
by: Mike P | last post by:
I am trying to return an output parameter to my code on executing a stored procedure. In Query Analyzer, it works with no problem, but when I run my ASP code below, the output parameter never...
3
by: leesquare | last post by:
Hello, I need some help getting output values from my stored procedures when using adodbapi. There's an example testVariableReturningStoredProcedure in adodbapitest.py, and that works for my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.