March 23, 2012 at 12:17 am
Is there anyway we can check the value returned by output parameter...
Like for example
Create sp_Example (@param datetime output)
As
Select @param = getdate()
return 0
I have 2 issues with this code
1. There is no way i can check if calling application is recieving the output from my sql server side. And the code is really working or not. There is no way to do unit testing for this code.
2. There is no way i can see what is being returned from sql server.
How to solve these 2 issues since this discourages me to use output parametes in my code??
March 23, 2012 at 12:20 am
1. There is no way i can check if calling application is recieving the output from my sql server side. And the code is really working or not. There is no way to do unit testing for this code.
2. There is no way i can see what is being returned from sql server.
Which application is calling it? Visual Studio code?
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle
March 23, 2012 at 12:23 am
It can be anything.. y should i be concered with it.. I just need to be sure my code does return the values..
March 23, 2012 at 12:27 am
I created your procedure in my Sandbox database (by the way, your create proc statement is missing something).
You can run the procedure like this to see what is being returned.
DECLARE @rc int
DECLARE @param datetime
-- TODO: Set parameter values here.
EXECUTE @rc = [Sandbox].[dbo].[sp_Example]
@param OUTPUT;
select @rc, @param;
GO
March 23, 2012 at 12:28 am
It can be anything.. y should i be concered with it.. I just need to be sure my code does return the values
The same reason why any Application Developer should be concerned about the code he/she runs against your database. It's a partnership you will never get away from.
The application developer can debug his code and step into your procedure, to confirm the results are passed.
Do you get results when executing the SP?
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle
March 23, 2012 at 12:32 am
itskanchanhere (3/23/2012)
It can be anything.. y should i be concered with it.. I just need to be sure my code does return the values..
You should be concerned that your code is returning the output expected based on the input values provided and that if there is any error conditions that can't be handled in your code that the proper exception(s) and error messages and information are returned, or if exceptions are propagated that they are the ones expected by the calling code.
March 23, 2012 at 12:34 am
No there is soem syntax problem in the create procedure .. i dint try it before posting.. Anyways what id the calling application is a separate group that does not co opersate with u.. In that case I need to do unit testing my self to justify myself
March 23, 2012 at 12:36 am
Also, look up EXECUTE (EXEC) in Books Online if you want more info on how it works and its syntax.
March 23, 2012 at 12:38 am
itskanchanhere (3/23/2012)
No there is soem syntax problem in the create procedure .. i dint try it before posting.. Anyways what id the calling application is a separate group that does not co opersate with u.. In that case I need to do unit testing my self to justify myself
Regarding the code you posted, no kidding, I told you that earlier.
If you don't cooperate with the other development group you all have a problem. You all should be on the same team, not fighting each other.
March 23, 2012 at 12:47 am
Have you fixed the code you posted earlier to create your test procedure and try running it with the code I gave you?
March 23, 2012 at 5:39 am
new project, need to instal it first before trying
March 23, 2012 at 6:42 am
itskanchanhere (3/23/2012)
new project, need to instal it first before trying
March 23, 2012 at 7:06 am
patrickmcginnis59 (3/23/2012)
itskanchanhere (3/23/2012)
new project, need to instal it first before trying
awesome linky Patrick, thank you! 😀
Lowell
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply