Output parameters in stored procedures SQL
--Use of output parameters in stored procedures---
--Output parameters are used where we want to pass value from a stored procedure to some external method which can be from SQL SERVER or any other platform.
select * from hotel
create procedure getid(@a int output)
as
declare
@b int
select @b=max(hotelid) from hotel
if @@rowcount=0
set @a=1
else
set @a=@b+1
--calling this procedure:--
declare
@c int
exec getid @c output
print @c
--Output parameters are used where we want to pass value from a stored procedure to some external method which can be from SQL SERVER or any other platform.
select * from hotel
create procedure getid(@a int output)
as
declare
@b int
select @b=max(hotelid) from hotel
if @@rowcount=0
set @a=1
else
set @a=@b+1
--calling this procedure:--
declare
@c int
exec getid @c output
print @c
Output parameters in stored procedures SQL
Reviewed by Rupesh
on
19:19
Rating:
No comments: