November 12, 2010 at 3:06 am
hi !
i have the following SP
ALTER Procedure [dbo].[Masters]
@Id int,
@Name varchar(100)
As begin
Declare @Masters as table (Id int primary key, Name varchar(100))
Insert into @Masters Values (@Id, @Name)
Select 'Record ' + CONVERT(varchar(8),@Id) + ' & ' + @Name + ' are inserted succesfully' + ' and the total count of Records are ' + CONVERT(varchar(10),COUNT(@Id))
End
I need to use it as a temp table without altering the database's original tables to store few records (not more than 20 lines).
I am struck here, that when ever i am executing it, it jus shows up with only one record count.
kindly give me a solution whenever i am executing a procedure it has to get in the values and stores the data in it itself and a way to view the records too..
Thanks !
November 12, 2010 at 4:49 am
First off , you are using a table variable here not a temporary table.
The table is being destroyed and recreated on each call so its not suprising your data is not there.
You could swap to using a temporary table (#) , but as you are using RS , i dont think that there is a away to guarantee that the calls will all happen on the same connection. If that is the case then each connection be writing to a different temp table.
Your best bet may be to create a new permanent table and write to that.
November 19, 2010 at 12:24 am
Fine ThkQ !
Left the idea to work on that further :O)
got into another task.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply