this is my prcoedure... - ALTER PROCEDURE test
-
@fromdate as varchar(50),
-
@todate as varchar(50),
-
@mailbox as varchar(25),
-
@open as int output,
-
@close as int output,
-
@queue as int output
-
-
-
AS
-
BEGIN
-
IF(@mailbox='HelpDeskOSA')
-
BEGIN
-
select @open=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox
-
and cast(@fromdate as datetime)< DateInitiated
-
and cast(@todate as datetime)> DateInitiated
-
-
select @close=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox
-
and [Status] in ('complete','canceled')
-
and [StatusDate] between cast(@fromdate as datetime)
-
and cast(@todate as datetime)
-
-
select @queue=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox
-
and [Status] not in ('complete','canceled')
-
and cast(@fromdate as datetime)< DateInitiated
-
and cast(@todate as datetime)> DateInitiated
-
-
END
-
-
IF(@mailbox='HelpWebJJ@esi-intl.com')
-
BEGIN
-
select @open=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox
-
and cast(@fromdate as datetime)< DateInitiated
-
and cast(@todate as datetime)> DateInitiated
-
-
select @close=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox
-
and [Status] in ('complete','canceled')
-
and [StatusDate] between cast(@fromdate as datetime)
-
and cast(@todate as datetime)
-
-
select @queue=count(*) from esinet_dbo.HelpDesk1 where Mailbox=@mailbox
-
and [Status] not in ('complete','canceled')
-
and cast(@fromdate as datetime)< DateInitiated
-
and cast(@todate as datetime)> DateInitiated
-
END
-
-
IF(@mailbox='All')
-
BEGIN
-
-
select @open=count(*) from esinet_dbo.HelpDesk1 where Mailbox in ('HelpDeskOSA','HelpWebJJ@esi-intl.com')
-
and cast(@fromdate as datetime)< DateInitiated
-
and cast(@todate as datetime)> DateInitiated
-
-
select @close=count(*) from esinet_dbo.HelpDesk1 where Mailbox in ('HelpDeskOSA','HelpWebJJ@esi-intl.com')
-
and [Status] in ('complete','canceled')
-
and [StatusDate] between cast(@fromdate as datetime)
-
and cast(@todate as datetime)
-
-
select @queue=count(*) from esinet_dbo.HelpDesk1 where Mailbox in ('HelpDeskOSA','HelpWebJJ@esi-intl.com')
-
and [Status] not in ('complete','canceled')
-
and cast(@fromdate as datetime)< DateInitiated
-
and cast(@todate as datetime)> DateInitiated
-
END
-
-
return @open
-
return @close
-
return @queue
-
-
-
-
-
END
thanx in advance.......
7 2111
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.
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?
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.
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...
what i want is just tell me is there anything wrong in my procedure....
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.
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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,...
|
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...
|
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
,...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |