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 2008 Forums
 Transact-SQL (2008)
 global table can not be accessed

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2013-07-12 : 05:32:48
Hello,
in sp1, there is a query like:
select * into ##tblTest from tblMain

in sp2, I am trying to access ##tblTest
as follows:

exec sp1
select * from ##tblTest

The error message I get in sp2 is :
Invalid object name '##tblTest'

Any thoughts please?
Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-12 : 06:02:42
try

exec sp1
go
select * from ##tblTest


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2013-07-12 : 06:03:03
quote:
Originally posted by arkiboys

Hello,
in sp1, there is a query like:
select * into ##tblTest from tblMain

in sp2, I am trying to access ##tblTest
as follows:

exec sp1
select * from ##tblTest

The error message I get in sp2 is :
Invalid object name '##tblTest'

Any thoughts please?
Thanks


The reason was that there was no data for the global table to be populated in the first place.
Tahnks anyway...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-12 : 06:06:57
quote:
Originally posted by arkiboys

quote:
Originally posted by arkiboys

Hello,
in sp1, there is a query like:
select * into ##tblTest from tblMain

in sp2, I am trying to access ##tblTest
as follows:

exec sp1
select * from ##tblTest

The error message I get in sp2 is :
Invalid object name '##tblTest'

Any thoughts please?
Thanks


The reason was that there was no data for the global table to be populated in the first place.
Tahnks anyway...


ok that makes sense

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -