Re: Problem with Output param for stored procedure
From: Ben (Ben_at_discussions.microsoft.com)
Date: 12/10/04
- Next message: Andre: "Recursive Table"
- Previous message: Stephen Howe: "SQL Server 7/2000 - FK Constraints"
- In reply to: Developer: "Re: Problem with Output param for stored procedure"
- Next in thread: Adam Machanic: "Re: Problem with Output param for stored procedure"
- Reply: Adam Machanic: "Re: Problem with Output param for stored procedure"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 10 Dec 2004 09:05:02 -0800
Adam has asked a couple times why you would provide an initial value to an
output parameter.
I have often used this method of parameterized stored procedures.
For example,
I have one sp to add/update a person record.
The stored procedure sees a value of zero for the ID and it knows to add the
record. Then I set the ID to the value generated by the insert statement.
If the value has a number greater than zero then I just update the record.
Sure, I could do the same thing using null instead of Zero.
Now I am curios if setting an initial value has a design flaw...I may want
to change my methods. Is this a bad practice or just a development preference?
Cheers,
Ben
"Developer" wrote:
> I do this -- get a value from an output param in other places -- so I
> decided to see what was different about this sp; as I recall, it used to
> work correctly.
> For some reason, "RETURN" at the end was commented out... I enabled
> that, loaded the sp, and it appears to work as expected.
>
> Thanks for your help.
>
> Ben wrote:
>
> > The problem is definitly not in the SP. Especially as you capture the .net
> > call and it's results and find it to be 1.
> >
> > So, the problem must be in your .Net code.
> >
> > We do this all the time in a couple apps here. I'll see if I can't find a
> > sample and post.
> >
> > Cheers,
> >
> > Ben
>
- Next message: Andre: "Recursive Table"
- Previous message: Stephen Howe: "SQL Server 7/2000 - FK Constraints"
- In reply to: Developer: "Re: Problem with Output param for stored procedure"
- Next in thread: Adam Machanic: "Re: Problem with Output param for stored procedure"
- Reply: Adam Machanic: "Re: Problem with Output param for stored procedure"
- Messages sorted by: [ date ] [ thread ]