Member of the LearnItFirst.com Video Training Network | LearnSqlServer.com | SQL SSIS Training | SQL Programming Tutorials |
LearnSqlServer.com Forums LearnSqlServer.com
Welcome Guest Search | New Posts | Members | Log In | Register

Error in Simple Output variable in stored procedure Options
kchirag
Posted: Tuesday, January 22, 2008 12:58:52 PM
Rank: Newbie

Joined: 1/22/2008
Posts: 1
Points: 3
Location: India
Hi Friends

I am new user of sql sever 2005, I am trying to write simple stored procedure which is return number of rows from table but when i execute procedure it is return error like


Server: Msg 201, Level 16, State 3, Procedure countrecored, Line 0
Procedure 'countrecored' expects parameter '@count_rec', which was not supplied.


and i write procedure like:

create procedure countrecored @count_rec int output
as
begin

select @count_rec = count(*) from Student;

end


. Confused
Scott Whigham
Posted: Monday, January 28, 2008 11:38:18 AM


Rank: Super Mod

Joined: 3/20/2006
Posts: 345
Points: 748
Location: Dallas, TX
To call your proc, do it like this:

DECLARE @local_variable INT
EXEC countrecord @count_rec = @local_variable OUT
SELECT @local_variable

Check out the videos on LearnTransactSQL.com and search for "output" in the search - there are a bunch of vids on how/why.
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
     
Don't Forget!
LearnItFirst.com
Don't Forget!
LearnWindows2003.com
 
Home | About Us | Support | Contact Us | Privacy | Site Map | Blogs Blogs Refer a Friend and Get a Free Subscription!
© Copyright 2004-2007 LearnItFirst.com LLC. All rights reserved. All trademarks remain the property of their respective owners.
This site is not affiliated in any way with the Microsoft Corporation.