Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
SQLIsTheDevil
Posting Yak Master
177 Posts |
Posted - 2007-12-19 : 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
30421 Posts |
Posted - 2007-12-19 : 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 thisCREATE PROCEDURE dbo.spSomeNameHere(@Param1 INT,@Param2 DATETIME OUT)ASSET NOCOUNT ON...... E 12°55'05.25"N 56°04'39.16" |
 |
|
SQLIsTheDevil
Posting Yak Master
177 Posts |
Posted - 2007-12-19 : 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
30421 Posts |
Posted - 2007-12-19 : 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" |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-12-19 : 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
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-12-20 : 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 |
 |
|
|
|
|