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 2005 Forums
 Transact-SQL (2005)
 Inserting data to table variable does not happen.

Author  Topic 

willfindavid
Starting Member

27 Posts

Posted - 2010-04-22 : 02:55:31
Hi,

When i execute the stored procedure(Exec statement below) i get the output, but when i store the values to a table variable the data is not stored in table variable.


DECLARE @SLA_STATUS TABLE (request_id BIGINT,sla_status VARCHAR(200))
INSERT INTO @SLA_STATUS
EXEC [SCHEMACOGPTG].[PR_SMGT_GET_SLA_FOR_AMReport] '183732,9625312,9625340,10062931,10062933,10062946,10062947,10062948,10062949,10062950,10062962,10062969,10062970,10062971,10063019,10063029,10063056'
select * from @SLA_STATUS

willfindavid
Starting Member

27 Posts

Posted - 2010-04-22 : 02:57:32
Have tried using temp table instead of table variable then too the same problem occurs.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-22 : 04:54:55
is stored procedure returning more than one resultset?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-22 : 06:34:14
Are number of columns same in table as well as reult of procedure?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

willfindavid
Starting Member

27 Posts

Posted - 2010-04-22 : 07:21:26
Only one resultset is returned, with two columns..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-22 : 08:42:50
Can you exeute this?

declare @t table(i int)
insert into @t
exec('select 1')
select * from @t


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -