Questions tagged [temp-tables]

Temporary tables are a feature of RDBMS's as a means of storing intermediate results. Some RDBMS's make the distinction between local and global temporary tables. Temporary tables are typically dropped when the session ends for local, or when the temporary table is no longer referenced for global. Note that a temporary table is not the same as a table variable even though both are temporary in nature.

The term temporary table is somewhat misleading, because the tables are permanent, just the data is somewhat volatile.

Temporary tables are useful to store intermediate data. Since it only exists for a session or a transaction the RDBMS doesn't have to worry about locks in order to synchronize between different transactions or redo information. This makes temporary tables often faster and more efficient then normal tables.

1637 questions
0
votes
1 answer

How to create a temporary table for an existing table with sqlalchemy?

I have a table(in mysql-server) associated with the following class: class Number(Base): __table_name__ = 'number' col0 = Column(...) # PRIMARY KEY col1 = Column(...) col2 = Column(...) col3 = Column(...) I want to create a…
Cricket
  • 491
  • 1
  • 7
  • 16
0
votes
1 answer

SQLite temporary tables/triggers and Microsoft's Entity Framework

Has anyone been able to create temporary tables or triggers using Microsoft's Entity Framework and SQLite? I have a working application that can create permanent tables and triggers, but not temporary ones. Listing sqlite_temp_master turns up no…
JBJB
  • 21
  • 4
0
votes
2 answers

Archiving the output from Delete Statement in Sql Server

I'm trying to archive the data into table (EMPTAB_Archive) by deleting the data from Production table (EMPTAB) using the temporary table (##TMP) as a reference. Note that temporary table contains two fields: empcode and empname, this is a part of…
Sreedhar Danturthi
  • 7,119
  • 19
  • 68
  • 111
0
votes
1 answer

SQL Server 2008 stored procedure returning different result with different database

I have stored procedure which when I execute in 2 different databases on same server is returning different results. e.g. in one DB it returns -4, -3.5, 3, -2.5, -2, -1,0 while in other DB it is returning 3, -4, 2.5, -1, -1.5 This has started…
0
votes
1 answer

LINQ TO SQL, stored procedure doesn't create a Temp Table

I'm coding a chat over a Webservice, running a SQL Express Server. I'm using C# on Visual Studio 2010. I have a sproc which should create a Temp Table. When I execute the procedure in the Management Studio it creates a Temp Table. But when i execute…
0
votes
1 answer

why the #tmpTable last row is null?

When i use this code to get the bak filename,why the #tmpTable last row is null? --Configure extension procedure the cmd_shell enable declare @backupfile_store_path varchar(200) ,@DynamicSql varchar(200) exec…
Dolphin
  • 29,069
  • 61
  • 260
  • 539
0
votes
1 answer

Xampp mysql memory engine temporary table full error 1114

Hello I have a problem caused by a full table error. This is how I create the table inside a stored procedure I run: CREATE TEMPORARY TABLE IF NOT EXISTS some_text ( id INT DEFAULT 0, string varchar(400) DEFAULT '' ) engine = memory; I then…
usumoio
  • 3,500
  • 6
  • 31
  • 57
0
votes
1 answer

How to load code before on form load

I have some code I need to load in before I want the code to run (I want to create a table), I tried 'Onload' but this is not soon enough, basically I'm looking for something just like OnInit() where I can load all I need before anything actually…
user2836518
0
votes
0 answers

Huge performance difference between table variables and temp tables

I have an UDF, providing a bunch of data. Several table variables are used. At this time, no indices are created. Runtime with testdata is about 30 sec. Only changing the table variables into temp tables ( out of the UDF, since #tables are not…
Nico
  • 1,175
  • 15
  • 33
0
votes
1 answer

The multi-part identifier could not be bound in Dynamic SQL using Trigger

Following is a part of my instead of update trigger CREATE TRIGGER TestDemo ON Consultants1 INSTEAD OF UPDATE AS DECLARE @Sql nvarchar(200), @TableName nvarchar(50), @FieldName nvarchar(100), …
0
votes
0 answers

Faster querying with temp table creation (SQL SERVER)

I've noticed that when I have a complex query, if I select into a temp table or create a new table from the query, the query seems faster to process then if I did not. I'm wondering if anyone else has noticed this effect, and could provide a reason…
rottentomato56
  • 1,059
  • 3
  • 13
  • 18
0
votes
1 answer

how to write the select statement in case statement

Let me know how to write select query in case statement. select ROW_NUMBER() OVER(Order by vendor.VendorName ) AS ID, PH.PurchasingHeaderID as BILLNo, PH.TotalPriceCompanyCurrency as Balance, acc.AccountName as [Account_Name] **Into…
Kavitha
  • 1,447
  • 2
  • 22
  • 37
0
votes
3 answers

SqlDataAdapter.FillSchema with stored procedure that has temporary table

I'm running into a problem similar to this question here (Display DataType and Size of Column from SQL Server Query Results at Runtime) which has not had a solid solution. I wonder if anyone has found a solution or a work around for it. I can use…
T L
  • 504
  • 2
  • 11
  • 27
0
votes
2 answers

Testing for the existence of a temporary table in a multi tempdb environment?

Is there any way of determining whether or not a specific temp table has been created in a session without referencing the tempdb database that it was created on? Users are allocated to a specific tempdb when they log in, so I don't know which…
ninesided
  • 23,085
  • 14
  • 83
  • 107
0
votes
1 answer

Attempt to create MySQL temporary table results in error "Base table or view not found"?

I'm trying to use a temporary table to hold a bunch of parameters for a search query using the following SQL query: CREATE TEMPORARY TABLE `patternmatch` (`pattern` VARCHAR(".strlen($this->fullQuery).")); INSERT INTO `patternmatch` VALUES…
marked-down
  • 9,958
  • 22
  • 87
  • 150