dbTalk Databases Forums  

Re: TEMPDB

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss Re: TEMPDB in the microsoft.public.sqlserver.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: TEMPDB - 08-18-2003 , 04:39 PM






Any local temp tables (ones created as #something) are automatically dropped
when the batch is done. If you use a CREATE TABLE Tempdb..xxxx the table
will stay there as long as the server does not get restarted. But then if 2
people call the same procedure your hosed. That's what LOCAL temp tables
are for. They are unique for each user so others won't see them. In either
case having such a dependency is really a poor design and you might want to
take this opportunity to redo this logic.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote

Quote:
Hello everyone,

I am in the process of converting an old Access database to SQL2000 to run
on a new application but the database table structure must not change. My
problem is many of the queries depend on the results of many other queries
which are stored in temporary tables. This was not a problem when it was
used by one user but now it's to be used by 107 users.

I looked a little bit into the TEMPDB option but I'm not too clear how
that
works. If a certain user is running reports and the queries create tables
in
the TEMPDB, are those tables automatically removed when the user logs out
of
the system? If not, is there some sort of batch process where SQL2000 can
delete tables from the TEMPDB that are over 2 days old?

Thank you and I apologize for my ignorance. I'm very new at using MSSQL.

- J





Reply With Quote
  #2  
Old   
Kalen Delaney
 
Posts: n/a

Default Re: TEMPDB - 08-18-2003 , 04:54 PM






Actually, #temp tables exist for the duration of the session, not just for
the batch. So to answer the original question, when the user logs out, the
session is terminated, so the temp table disappears.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote

Quote:
Any local temp tables (ones created as #something) are automatically
dropped
when the batch is done. If you use a CREATE TABLE Tempdb..xxxx the table
will stay there as long as the server does not get restarted. But then if
2
people call the same procedure your hosed. That's what LOCAL temp tables
are for. They are unique for each user so others won't see them. In
either
case having such a dependency is really a poor design and you might want
to
take this opportunity to redo this logic.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote in message
news:%23XMTSjcZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hello everyone,

I am in the process of converting an old Access database to SQL2000 to
run
on a new application but the database table structure must not change.
My
problem is many of the queries depend on the results of many other
queries
which are stored in temporary tables. This was not a problem when it was
used by one user but now it's to be used by 107 users.

I looked a little bit into the TEMPDB option but I'm not too clear how
that
works. If a certain user is running reports and the queries create
tables
in
the TEMPDB, are those tables automatically removed when the user logs
out
of
the system? If not, is there some sort of batch process where SQL2000
can
delete tables from the TEMPDB that are over 2 days old?

Thank you and I apologize for my ignorance. I'm very new at using MSSQL.

- J







Reply With Quote
  #3  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: TEMPDB - 08-18-2003 , 06:22 PM



Yes that's can be true depending on how and where he creates them. I was
assuming (Probably shouldn't have) that they created the temp table in sp's
called from an outer one similar to this:

create proc test1
as

select * into #t
from orders where 1 = 2

SELECT * FROM #t

GO

exec test1

select * from #t


So Jay in that case the temp table is dropped at the end of the batch but if
you did CREATE TABLE #t (...) before calling the sp's it would exist until
the end of the session as Kalen suggested. Thank's for pointing that out
Kalen.


--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote

Quote:
Actually, #temp tables exist for the duration of the session, not just for
the batch. So to answer the original question, when the user logs out, the
session is terminated, so the temp table disappears.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:#ymf7EdZDHA.656 (AT) tk2msftngp13 (DOT) phx.gbl...
Any local temp tables (ones created as #something) are automatically
dropped
when the batch is done. If you use a CREATE TABLE Tempdb..xxxx the
table
will stay there as long as the server does not get restarted. But then
if
2
people call the same procedure your hosed. That's what LOCAL temp
tables
are for. They are unique for each user so others won't see them. In
either
case having such a dependency is really a poor design and you might want
to
take this opportunity to redo this logic.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote in message
news:%23XMTSjcZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hello everyone,

I am in the process of converting an old Access database to SQL2000 to
run
on a new application but the database table structure must not change.
My
problem is many of the queries depend on the results of many other
queries
which are stored in temporary tables. This was not a problem when it
was
used by one user but now it's to be used by 107 users.

I looked a little bit into the TEMPDB option but I'm not too clear how
that
works. If a certain user is running reports and the queries create
tables
in
the TEMPDB, are those tables automatically removed when the user logs
out
of
the system? If not, is there some sort of batch process where SQL2000
can
delete tables from the TEMPDB that are over 2 days old?

Thank you and I apologize for my ignorance. I'm very new at using
MSSQL.

- J









Reply With Quote
  #4  
Old   
Kalen Delaney
 
Posts: n/a

Default Re: TEMPDB - 08-18-2003 , 06:45 PM



Yes, temp tables created in a sp have a lifespan of the sp. But that is
still not the same as a batch. You can have multiple proc calls in a single
batch.
A batch is a very specific construct in SQL Server, but doesn't affect the
scope or lifespan of temp table. (A batch does however affect the scope of a
local variable.)

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote

Quote:
Yes that's can be true depending on how and where he creates them. I was
assuming (Probably shouldn't have) that they created the temp table in
sp's
called from an outer one similar to this:

create proc test1
as

select * into #t
from orders where 1 = 2

SELECT * FROM #t

GO

exec test1

select * from #t


So Jay in that case the temp table is dropped at the end of the batch but
if
you did CREATE TABLE #t (...) before calling the sp's it would exist until
the end of the session as Kalen suggested. Thank's for pointing that out
Kalen.


--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote in message
news:u3NbANdZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Actually, #temp tables exist for the duration of the session, not just
for
the batch. So to answer the original question, when the user logs out,
the
session is terminated, so the temp table disappears.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:#ymf7EdZDHA.656 (AT) tk2msftngp13 (DOT) phx.gbl...
Any local temp tables (ones created as #something) are automatically
dropped
when the batch is done. If you use a CREATE TABLE Tempdb..xxxx the
table
will stay there as long as the server does not get restarted. But
then
if
2
people call the same procedure your hosed. That's what LOCAL temp
tables
are for. They are unique for each user so others won't see them. In
either
case having such a dependency is really a poor design and you might
want
to
take this opportunity to redo this logic.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote in message
news:%23XMTSjcZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hello everyone,

I am in the process of converting an old Access database to SQL2000
to
run
on a new application but the database table structure must not
change.
My
problem is many of the queries depend on the results of many other
queries
which are stored in temporary tables. This was not a problem when it
was
used by one user but now it's to be used by 107 users.

I looked a little bit into the TEMPDB option but I'm not too clear
how
that
works. If a certain user is running reports and the queries create
tables
in
the TEMPDB, are those tables automatically removed when the user
logs
out
of
the system? If not, is there some sort of batch process where
SQL2000
can
delete tables from the TEMPDB that are over 2 days old?

Thank you and I apologize for my ignorance. I'm very new at using
MSSQL.

- J











Reply With Quote
  #5  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: TEMPDB - 08-18-2003 , 07:06 PM



Ahhh, yes of coarse you are correct. I shouldn't have used the term "Batch"
in that manner. Sorry for the confusion and thanks for the correction
Kalen..

--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote

Quote:
Yes, temp tables created in a sp have a lifespan of the sp. But that is
still not the same as a batch. You can have multiple proc calls in a
single
batch.
A batch is a very specific construct in SQL Server, but doesn't affect the
scope or lifespan of temp table. (A batch does however affect the scope of
a
local variable.)

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:eJO9M#dZDHA.2284 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Yes that's can be true depending on how and where he creates them. I
was
assuming (Probably shouldn't have) that they created the temp table in
sp's
called from an outer one similar to this:

create proc test1
as

select * into #t
from orders where 1 = 2

SELECT * FROM #t

GO

exec test1

select * from #t


So Jay in that case the temp table is dropped at the end of the batch
but
if
you did CREATE TABLE #t (...) before calling the sp's it would exist
until
the end of the session as Kalen suggested. Thank's for pointing that
out
Kalen.


--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote in message
news:u3NbANdZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Actually, #temp tables exist for the duration of the session, not just
for
the batch. So to answer the original question, when the user logs out,
the
session is terminated, so the temp table disappears.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:#ymf7EdZDHA.656 (AT) tk2msftngp13 (DOT) phx.gbl...
Any local temp tables (ones created as #something) are automatically
dropped
when the batch is done. If you use a CREATE TABLE Tempdb..xxxx the
table
will stay there as long as the server does not get restarted. But
then
if
2
people call the same procedure your hosed. That's what LOCAL temp
tables
are for. They are unique for each user so others won't see them.
In
either
case having such a dependency is really a poor design and you might
want
to
take this opportunity to redo this logic.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote in message
news:%23XMTSjcZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hello everyone,

I am in the process of converting an old Access database to
SQL2000
to
run
on a new application but the database table structure must not
change.
My
problem is many of the queries depend on the results of many other
queries
which are stored in temporary tables. This was not a problem when
it
was
used by one user but now it's to be used by 107 users.

I looked a little bit into the TEMPDB option but I'm not too clear
how
that
works. If a certain user is running reports and the queries create
tables
in
the TEMPDB, are those tables automatically removed when the user
logs
out
of
the system? If not, is there some sort of batch process where
SQL2000
can
delete tables from the TEMPDB that are over 2 days old?

Thank you and I apologize for my ignorance. I'm very new at using
MSSQL.

- J













Reply With Quote
  #6  
Old   
Jay
 
Posts: n/a

Default Re: TEMPDB - 08-18-2003 , 09:24 PM



Thank you both for the information. A lot has been cleared up. :-)

I plan to create the temp table from an ASP.NET application. When the user
is finished with the application, is it safe to assume that the temp table
will be removed?

Thanks again!!!

- J



"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote

Quote:
Ahhh, yes of coarse you are correct. I shouldn't have used the term
"Batch"
in that manner. Sorry for the confusion and thanks for the correction
Kalen..

--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote in message
news:ej8tTLeZDHA.2020 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Yes, temp tables created in a sp have a lifespan of the sp. But that is
still not the same as a batch. You can have multiple proc calls in a
single
batch.
A batch is a very specific construct in SQL Server, but doesn't affect
the
scope or lifespan of temp table. (A batch does however affect the scope
of
a
local variable.)

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:eJO9M#dZDHA.2284 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Yes that's can be true depending on how and where he creates them. I
was
assuming (Probably shouldn't have) that they created the temp table in
sp's
called from an outer one similar to this:

create proc test1
as

select * into #t
from orders where 1 = 2

SELECT * FROM #t

GO

exec test1

select * from #t


So Jay in that case the temp table is dropped at the end of the batch
but
if
you did CREATE TABLE #t (...) before calling the sp's it would exist
until
the end of the session as Kalen suggested. Thank's for pointing that
out
Kalen.


--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote in message
news:u3NbANdZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Actually, #temp tables exist for the duration of the session, not
just
for
the batch. So to answer the original question, when the user logs
out,
the
session is terminated, so the temp table disappears.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:#ymf7EdZDHA.656 (AT) tk2msftngp13 (DOT) phx.gbl...
Any local temp tables (ones created as #something) are
automatically
dropped
when the batch is done. If you use a CREATE TABLE Tempdb..xxxx
the
table
will stay there as long as the server does not get restarted. But
then
if
2
people call the same procedure your hosed. That's what LOCAL temp
tables
are for. They are unique for each user so others won't see them.
In
either
case having such a dependency is really a poor design and you
might
want
to
take this opportunity to redo this logic.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote in message
news:%23XMTSjcZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hello everyone,

I am in the process of converting an old Access database to
SQL2000
to
run
on a new application but the database table structure must not
change.
My
problem is many of the queries depend on the results of many
other
queries
which are stored in temporary tables. This was not a problem
when
it
was
used by one user but now it's to be used by 107 users.

I looked a little bit into the TEMPDB option but I'm not too
clear
how
that
works. If a certain user is running reports and the queries
create
tables
in
the TEMPDB, are those tables automatically removed when the user
logs
out
of
the system? If not, is there some sort of batch process where
SQL2000
can
delete tables from the TEMPDB that are over 2 days old?

Thank you and I apologize for my ignorance. I'm very new at
using
MSSQL.

- J















Reply With Quote
  #7  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: TEMPDB - 08-19-2003 , 07:49 AM



That depends on what the user does when he is finished. It is usually best
not to assume anything if you can do something to take out those
assumptions. It's not a lot of code to drop the table when your finished
with it.

IF OBJECT_ID('tempdb..#YourTable') IS NOT NULL
DROP TABLE #YourTable

But if the user drops the connection and it is not being pooled (or is and
is properly cleaned up) then yes it will be dropped. Otherwise no.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote

Quote:
Thank you both for the information. A lot has been cleared up. :-)

I plan to create the temp table from an ASP.NET application. When the user
is finished with the application, is it safe to assume that the temp table
will be removed?

Thanks again!!!

- J



"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:uV2IAXeZDHA.2020 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Ahhh, yes of coarse you are correct. I shouldn't have used the term
"Batch"
in that manner. Sorry for the confusion and thanks for the correction
Kalen..

--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote in message
news:ej8tTLeZDHA.2020 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Yes, temp tables created in a sp have a lifespan of the sp. But that
is
still not the same as a batch. You can have multiple proc calls in a
single
batch.
A batch is a very specific construct in SQL Server, but doesn't affect
the
scope or lifespan of temp table. (A batch does however affect the
scope
of
a
local variable.)

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:eJO9M#dZDHA.2284 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Yes that's can be true depending on how and where he creates them.
I
was
assuming (Probably shouldn't have) that they created the temp table
in
sp's
called from an outer one similar to this:

create proc test1
as

select * into #t
from orders where 1 = 2

SELECT * FROM #t

GO

exec test1

select * from #t


So Jay in that case the temp table is dropped at the end of the
batch
but
if
you did CREATE TABLE #t (...) before calling the sp's it would exist
until
the end of the session as Kalen suggested. Thank's for pointing
that
out
Kalen.


--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote in message
news:u3NbANdZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Actually, #temp tables exist for the duration of the session, not
just
for
the batch. So to answer the original question, when the user logs
out,
the
session is terminated, so the temp table disappears.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:#ymf7EdZDHA.656 (AT) tk2msftngp13 (DOT) phx.gbl...
Any local temp tables (ones created as #something) are
automatically
dropped
when the batch is done. If you use a CREATE TABLE Tempdb..xxxx
the
table
will stay there as long as the server does not get restarted.
But
then
if
2
people call the same procedure your hosed. That's what LOCAL
temp
tables
are for. They are unique for each user so others won't see
them.
In
either
case having such a dependency is really a poor design and you
might
want
to
take this opportunity to redo this logic.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote in message
news:%23XMTSjcZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hello everyone,

I am in the process of converting an old Access database to
SQL2000
to
run
on a new application but the database table structure must not
change.
My
problem is many of the queries depend on the results of many
other
queries
which are stored in temporary tables. This was not a problem
when
it
was
used by one user but now it's to be used by 107 users.

I looked a little bit into the TEMPDB option but I'm not too
clear
how
that
works. If a certain user is running reports and the queries
create
tables
in
the TEMPDB, are those tables automatically removed when the
user
logs
out
of
the system? If not, is there some sort of batch process where
SQL2000
can
delete tables from the TEMPDB that are over 2 days old?

Thank you and I apologize for my ignorance. I'm very new at
using
MSSQL.

- J

















Reply With Quote
  #8  
Old   
Jay
 
Posts: n/a

Default Re: TEMPDB - 08-19-2003 , 09:50 AM



Thanks again! :-)

- J

"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote

Quote:
That depends on what the user does when he is finished. It is usually
best
not to assume anything if you can do something to take out those
assumptions. It's not a lot of code to drop the table when your finished
with it.

IF OBJECT_ID('tempdb..#YourTable') IS NOT NULL
DROP TABLE #YourTable

But if the user drops the connection and it is not being pooled (or is and
is properly cleaned up) then yes it will be dropped. Otherwise no.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote in message
news:e5rUMkfZDHA.2464 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
Thank you both for the information. A lot has been cleared up. :-)

I plan to create the temp table from an ASP.NET application. When the
user
is finished with the application, is it safe to assume that the temp
table
will be removed?

Thanks again!!!

- J



"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:uV2IAXeZDHA.2020 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Ahhh, yes of coarse you are correct. I shouldn't have used the term
"Batch"
in that manner. Sorry for the confusion and thanks for the correction
Kalen..

--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote in message
news:ej8tTLeZDHA.2020 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Yes, temp tables created in a sp have a lifespan of the sp. But that
is
still not the same as a batch. You can have multiple proc calls in a
single
batch.
A batch is a very specific construct in SQL Server, but doesn't
affect
the
scope or lifespan of temp table. (A batch does however affect the
scope
of
a
local variable.)

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:eJO9M#dZDHA.2284 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Yes that's can be true depending on how and where he creates them.
I
was
assuming (Probably shouldn't have) that they created the temp
table
in
sp's
called from an outer one similar to this:

create proc test1
as

select * into #t
from orders where 1 = 2

SELECT * FROM #t

GO

exec test1

select * from #t


So Jay in that case the temp table is dropped at the end of the
batch
but
if
you did CREATE TABLE #t (...) before calling the sp's it would
exist
until
the end of the session as Kalen suggested. Thank's for pointing
that
out
Kalen.


--

Andrew J. Kelly
SQL Server MVP


"Kalen Delaney" <replies (AT) public_newsgroups (DOT) com> wrote in message
news:u3NbANdZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Actually, #temp tables exist for the duration of the session,
not
just
for
the batch. So to answer the original question, when the user
logs
out,
the
session is terminated, so the temp table disappears.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:#ymf7EdZDHA.656 (AT) tk2msftngp13 (DOT) phx.gbl...
Any local temp tables (ones created as #something) are
automatically
dropped
when the batch is done. If you use a CREATE TABLE
Tempdb..xxxx
the
table
will stay there as long as the server does not get restarted.
But
then
if
2
people call the same procedure your hosed. That's what LOCAL
temp
tables
are for. They are unique for each user so others won't see
them.
In
either
case having such a dependency is really a poor design and you
might
want
to
take this opportunity to redo this logic.

--

Andrew J. Kelly
SQL Server MVP


"Jay" <jerry280 (AT) yahoo (DOT) com> wrote in message
news:%23XMTSjcZDHA.2632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hello everyone,

I am in the process of converting an old Access database to
SQL2000
to
run
on a new application but the database table structure must
not
change.
My
problem is many of the queries depend on the results of many
other
queries
which are stored in temporary tables. This was not a problem
when
it
was
used by one user but now it's to be used by 107 users.

I looked a little bit into the TEMPDB option but I'm not too
clear
how
that
works. If a certain user is running reports and the queries
create
tables
in
the TEMPDB, are those tables automatically removed when the
user
logs
out
of
the system? If not, is there some sort of batch process
where
SQL2000
can
delete tables from the TEMPDB that are over 2 days old?

Thank you and I apologize for my ignorance. I'm very new at
using
MSSQL.

- J



















Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.