
Timeout expired, [Microsoft OLE DB Provider for SQL Server]
Quote:
> Erland when we do a Select with an INTO clause the TempDB is locked for
> the preiod of creation of the #table ... On the contrary when we use a
> Create table #table and then do a Insert into then the tempDB is locked
> for the period of creation of the table only ... Hence any operation
> that requires TempDB's service becomes inaccessible during this period
> of time ... Correct me if Iam wrong here ...
Are you running SQL Server 6.5? The symptom you describe is well-known
for 6.5. The reason is that as long as the SELECT INTO statement runs,
it holds locks in sysobjects and syscolumns. On 6.5 which only has page
locks this effectively prevents other processes from creating temp
tables, which may seem that the server is completely inaccessible. You
cannot connect from Enterprise Manager because it creates temp tables.
ISQL/w will do, though.
On SQL7 and SQL2000, the difference is that since the locks are row
locks, other processes can still create temp tables, and the problem
is usually not that severe.
There is a trace flag for 6.5 which changes the behaviour, so that when
the flag is in effect, the locks are released once the table has been
created, so if the query is long-running, other processes are not
affected.
Unfortunately, I don't remember the number of the trace flag, and it
is not in Books Online, because it was added in SP1 or SP2 to SQL 6.5.
--
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp