Nate
Nate

Reputation: 847

Sql Server out on parameter

What does out mean on a stored procedure?

Create Procedure [schema].[proc_Name]
@valueone int out
As
Begin 
    Update [Table] set Value = @valueone
end

Upvotes: 0

Views: 34

Answers (2)

Toby Simmerling
Toby Simmerling

Reputation: 2244

It means you can pass information "Out" of the procedure, useful for an inserted row to get the ID or something like that

this code sample should explain it.

Create Procedure dbo.[proc_Name]
    @valueone int out
As
Begin 

    set @valueone =  @valueone + 1 

end

GO

declare @valueone int

set @valueone =99

exec [proc_Name] @valueone OUT

select @valueone

Upvotes: 1

Z .
Z .

Reputation: 12837

Nothing (in this particular case)

Otherwise it is an output parameter as you probably suspected. So if you change the value of @valueone inside the stored proc, that value will be returned to the caller.

Upvotes: 1

Related Questions