Insert Into...in Store Prcedure with variable
hello
i have this store procedure...
CREATE PROCEDURE [dbo].[RC] AS
select count(*) as Resulte from calls_pool
GO
it returns me the recordcount of the table calls pool.
also i have this procedure...
CREATE PROCEDURE [dbo].[inserta] AS
declare @return bigint
exec @return=RC
insert into oop (aaa) values (@return)
GO
into the procedure inserta, i want to load to the variable @return the recordcount (like function). then i want to insert this value to the table oop... but into the table stores me the value 0... if i replace the setence :
"insert into oop (aaa) values (@return)"
with the setence
"PRINT 'The sp returned: ' + convert(char(2),@return)" it work normal!
why is happend????
Thanks
Re: Insert Into...in Store Prcedure with variable
Change your first procedure so that it is able to return value once it checks the count
PHP Code:
CREATE PROCEDURE [dbo].[RC] AS
return (select count(*) as Resulte from calls_pool)
GO
That should solve your problem.
Re: Insert Into...in Store Prcedure with variable
it works!
i know for the return value but i think it's very stupit to return the value twice....
it was the only thing that i don't try for the upper reason....
Thanks a lot Shuja!