|
-
February 24th, 2006, 05:03 AM
#1
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
Good Luck
-------------------*-------------------*------------------------
Today we will see how we can develop:
Ingredients:
Espresso, cigarettes and lounge music
-----------------------------------------------------------------
Please remember to rate the posts and threads that you find useful
-
February 24th, 2006, 09:26 AM
#2
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.
-
February 24th, 2006, 09:34 AM
#3
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!
Good Luck
-------------------*-------------------*------------------------
Today we will see how we can develop:
Ingredients:
Espresso, cigarettes and lounge music
-----------------------------------------------------------------
Please remember to rate the posts and threads that you find useful
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|