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 in stored procedures SQL Reviewed by Rupesh on 19:19 Rating: 5

No comments:

All Rights Reserved by Technology from Developers Eye © 2014 - 2015
Powered By Blogger, Designed by Aadics
Disclaimers:: The information provided within this blogsite is for general informational purposes only. While we try to keep the information up-to-date and correct, there are no representations or warranties, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information, products, services, or related graphics contained in this blogsite for any purpose.The author does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause.

Contact Form

Name

Email *

Message *

Powered by Blogger.