By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,265 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,265 IT Pros & Developers. It's quick & easy.

purpose of OUTPUT keyword in sql server

P: n/a

hello sirs
purpose OUTPUT keyword with examples

May 17 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
surya (su*******@gmail.com) writes:
hello sirs
purpose OUTPUT keyword with examples


You use OUTPUT to specify that a parameter is an output parameter:

CREATE PROCEDURE getordercount @custid int, @cnt OUTPUT AS
SELECT @cnt = COUNT(*) FROM orders WHERE custid = @custid

What is special with T-SQL, is that you need to specify OUTPUT also when you
call the procedure:

EXEC getordercount @custid, @cnt OUTPUT
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
May 17 '06 #2

P: n/a
Erland,

you said right about OUTPUT parameters...
but what about the OUTPUT clause of
DELETE, INSERT and UPDATE statements
in SQL Server 2005?

surya, for more details about the OUTPUT clause see the following link:
http://msdn2.microsoft.com/en-us/library/ms177564.aspx

---
Andrey Odegov
av******@yandex.ru
(remove GOV to respond)

May 17 '06 #3

P: n/a
avode (av********@yahoo.com) writes:
you said right about OUTPUT parameters...
but what about the OUTPUT clause of
DELETE, INSERT and UPDATE statements
in SQL Server 2005?
Sorry! There's so much new stuff, that I tend to forget some of it.
The OUTPUT clause in one of the more obscure items.
surya, for more details about the OUTPUT clause see the following link:
http://msdn2.microsoft.com/en-us/library/ms177564.aspx


....and if it was in that context you asked about OUTPUT, surya, please
tell us if you want more clarifcation.

Thanks for posting the link Andrey.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
May 17 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.