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)
 Help regarding global temporary tables.

Author  Topic 

pmotewar
Yak Posting Veteran

62 Posts

Posted - 2009-06-06 : 03:19:26
hi,
i have 2 procedures procA , procB

in ProcA i created global temporary table ##abc

in procB i called the procA and used the table ##abc. but when i called procB at same time by 2 user it gives me error.
invalid object name ##abc. ##abc already present in database.
what should i do to avoid this error.

any help appreciated.

Pankaj

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-06 : 03:39:17
this is because the 2nd user when call procB, it will also call ProcA and create the global temp table.

use local temporary table instead. create the local temp table in procB instead of procA. procA is executing within the scope of procB, it will have access to the local temp table created in procB


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pmotewar
Yak Posting Veteran

62 Posts

Posted - 2009-06-06 : 04:54:51
Thanks Khtan,

thanks for quick reply, i have made changes in procedure.it is working fine with single user. now i am going to check with multiple user.




quote:
Originally posted by khtan

this is because the 2nd user when call procB, it will also call ProcA and create the global temp table.

use local temporary table instead. create the local temp table in procB instead of procA. procA is executing within the scope of procB, it will have access to the local temp table created in procB


KH
[spoiler]Time is always against us[/spoiler]





Pankaj
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-07 : 03:51:26
also see this

http://databases.aspfaq.com/database/should-i-use-a-temp-table-or-a-table-variable.html
Go to Top of Page
   

- Advertisement -