| Author |
Topic  |
|
|
SQLIsTheDevil
Posting Yak Master
USA
171 Posts |
Posted - 12/19/2007 : 12:36:07
|
| Simple question really: How do I specify a paramter as both input and output in a procedure? |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
Posted - 12/19/2007 : 12:47:40
|
quote: Originally posted by SQLIsTheDevil
Simple question really: How do I specify a paramter as both input and output in a procedure?
A parameter is always in input parameter. To declare the parameter to be output as well, write this
CREATE PROCEDURE dbo.spSomeNameHere ( @Param1 INT, @Param2 DATETIME OUT ) AS
SET NOCOUNT ON
... ...
E 12°55'05.25" N 56°04'39.16" |
Edited by - SwePeso on 12/19/2007 12:58:36 |
 |
|
|
SQLIsTheDevil
Posting Yak Master
USA
171 Posts |
Posted - 12/19/2007 : 12:55:32
|
| No, I think you misunderstood. I meant how do define a paramter as both input and output, not just one or the other? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
Posted - 12/19/2007 : 12:58:16
|
quote: Originally posted by SQLIsTheDevil
No, I think you misunderstood. I meant how do define a paramter as both input and output, not just one or the other?
I thought I explained it perfectly well. Ok, I will try again.
A parameter is ALWAYS in input parameter. You can't change that. If you want a certain parameter to be BOTH input AND output parameter (as I wrote before "as well") then add the OUT keyword after the datatype for the parameter.
Still confusing?
E 12°55'05.25" N 56°04'39.16" |
Edited by - SwePeso on 12/19/2007 12:58:52 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47023 Posts |
Posted - 12/19/2007 : 13:06:01
|
| By default you can pass a value through parameter (Input). If you want value to be taken back from parameter as well define it as OUTPUT. |
 |
|
|
jezemine
Flowing Fount of Yak Knowledge
USA
2871 Posts |
Posted - 12/20/2007 : 08:51:48
|
t-sql syntax make no distinction between inout and out. they are both marked with the OUTPUT keyword.
as a programmer, you might make a distinction in that if the proc returns exactly the same results for all values of an out param, you might refer to it as a pure out param, because the param is not used as input. if its behavior changes, then you might call it an inout param.
elsasoft.org |
 |
|
| |
Topic  |
|