|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Newbie question Local Temp Tables vs Global Temp TablesI'm trying to find the distinction between Local temp tables vs. Global Temp
Tables. Seem that Global temp tables have greater persistence when using a stored procedure with a returning select statement. Question: Are any of the #tempLocalTable or ##tempGlobalTable accessible from other network users? i.e. can user using the same stored procedures at the same time overwrite either of these tables? Thanks for the answers. Stephen K. Miyasato Local temp tables are private to the connection created the tamp table. Global temp tables are not,
they are ... global. -- Show quoteTibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ Blog: http://solidqualitylearning.com/blogs/tibor/ "Stephen K. Miyasato" <miya***@flex.com> wrote in message news:u78Xuj2TGHA.1576@tk2msftngp13.phx.gbl... > I'm trying to find the distinction between Local temp tables vs. Global Temp Tables. > > Seem that Global temp tables have greater persistence when using a stored procedure with a > returning select statement. > > Question: Are any of the #tempLocalTable or ##tempGlobalTable accessible from other network users? > i.e. can user using the same stored procedures at the same time overwrite either of these tables? > > Thanks for the answers. > > Stephen K. Miyasato > > Yes, global temp tables have greater persistence, but I've never found an
actual need to retain a temporary table beyond the context of the procedure that created it. Have you? Show quote "Stephen K. Miyasato" <miya***@flex.com> wrote in message news:u78Xuj2TGHA.1576@tk2msftngp13.phx.gbl... > I'm trying to find the distinction between Local temp tables vs. Global > Temp Tables. > > Seem that Global temp tables have greater persistence when using a stored > procedure with a returning select statement. > > Question: Are any of the #tempLocalTable or ##tempGlobalTable accessible > from other network users? i.e. can user using the same stored procedures > at the same time overwrite either of these tables? > > Thanks for the answers. > > Stephen K. Miyasato > > I guess when I did do a stored procedure, I found that the #tempLocalTable
was not available, so I thought using he global tables would have been a solution. Perhaps I'm doing it wrong. I ended up using regular tables but when the stored procedure were used on different stations simultaneously, I would get results not related to the patient. Thanks, Stephen K. Miyasato Show quote "JT" <some***@microsoft.com> wrote in message news:ugUTNx3TGHA.1868@TK2MSFTNGP09.phx.gbl... > Yes, global temp tables have greater persistence, but I've never found an > actual need to retain a temporary table beyond the context of the > procedure that created it. Have you? > > "Stephen K. Miyasato" <miya***@flex.com> wrote in message > news:u78Xuj2TGHA.1576@tk2msftngp13.phx.gbl... >> I'm trying to find the distinction between Local temp tables vs. Global >> Temp Tables. >> >> Seem that Global temp tables have greater persistence when using a stored >> procedure with a returning select statement. >> >> Question: Are any of the #tempLocalTable or ##tempGlobalTable accessible >> from other network users? i.e. can user using the same stored procedures >> at the same time overwrite either of these tables? >> >> Thanks for the answers. >> >> Stephen K. Miyasato >> >> > > Global and permanent tables are visible to all connections so you need to
account for multi-user environments when using these for transitory data. It's best to stick with a local temp table or table variable in those cases. -- Show quoteHope this helps. Dan Guzman SQL Server MVP "Stephen K. Miyasato" <miya***@flex.com> wrote in message news:OiWhVq4TGHA.1160@TK2MSFTNGP09.phx.gbl... >I guess when I did do a stored procedure, I found that the #tempLocalTable >was not available, so I thought using he global tables would have been a >solution. Perhaps I'm doing it wrong. I ended up using regular tables but >when the stored procedure were used on different stations simultaneously, I >would get results not related to the patient. > > Thanks, > > Stephen K. Miyasato > > "JT" <some***@microsoft.com> wrote in message > news:ugUTNx3TGHA.1868@TK2MSFTNGP09.phx.gbl... >> Yes, global temp tables have greater persistence, but I've never found an >> actual need to retain a temporary table beyond the context of the >> procedure that created it. Have you? >> >> "Stephen K. Miyasato" <miya***@flex.com> wrote in message >> news:u78Xuj2TGHA.1576@tk2msftngp13.phx.gbl... >>> I'm trying to find the distinction between Local temp tables vs. Global >>> Temp Tables. >>> >>> Seem that Global temp tables have greater persistence when using a >>> stored procedure with a returning select statement. >>> >>> Question: Are any of the #tempLocalTable or ##tempGlobalTable accessible >>> from other network users? i.e. can user using the same stored procedures >>> at the same time overwrite either of these tables? >>> >>> Thanks for the answers. >>> >>> Stephen K. Miyasato >>> >>> >> >> > >
Other interesting topics
|
|||||||||||||||||||||||