SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 global table can not be accessed
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

arkiboys
Flowing Fount of Yak Knowledge

1417 Posts

Posted - 07/12/2013 :  05:32:48  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 07/12/2013 :  06:02:42  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

1417 Posts

Posted - 07/12/2013 :  06:03:03  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 07/12/2013 :  06:06:57  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000