Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 OUTPUT problems

Author  Topic 

allan_houston
Starting Member

18 Posts

Posted - 2006-07-09 : 08:16:57
Hello everyone


I have a problem with my stored procedure. I'm in learning stage right now so I'm really a freshman.

I created a procedure that you can see under this text. My third parameter is an OUTPUT parameter. Yesterday I could execute this procedure like this:

exec qAreal 5, 3.5 but today this procedure is complainint and demands the third parameter to be inputed.
Why?????


create proc qAreal
@num1 decimal(10, 2), @num2 decimal(10, 2), @res decimal(10, 2) OUTPUT
as

declare @temp_res decimal(10, 2)
select @temp_res = @num1 * @num2

--OUTPUT
set @res = @temp_res


--END SP


Thx for any help

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-09 : 09:45:27
It would always complain about that call.
You can either make the parameter optional or add it to the call
exec qAreal 5, 3.5, null

or
create proc qAreal
@num1 decimal(10, 2), @num2 decimal(10, 2), @res decimal(10, 2) = null OUTPUT
as
...

you won't get the result though so you should
declare @res decimal(10, 2)
exec qAreal 5, 3.5, @res out
select @res


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

allan_houston
Starting Member

18 Posts

Posted - 2006-07-09 : 10:24:51
Thanks a lot nr.
That really made the problem logical.
Go to Top of Page
   

- Advertisement -