What is a SQL Server Temporary Table?
Answer / mohammadali.info
Temporary tables are a useful tool in SQL Server provided to allow for short term use of data. There are two types of temporary table in SQL Server, local and global.
Local temporary tables are only available to the current connection to the database for the current user and are dropped when the connection is closed. Global temporary tables are available to any connection once created, and are dropped when the last connection using it is closed.
Both types of temporary tables are created in the system database tempdb.
Temporary tables can be created like any table in SQL Server with a CREATE TABLE or SELECT..INTO statement. To make the table a local temporary table, you simply prefix the name with a (#). To make the table a global temporary table, prefix it with (##).
-- Create a local temporary table using CREATE TABLE
CREATE TABLE #myTempTable
(
DummyField1 INT,
DummyField2 VARCHAR(20)
)
-- Create a local temporary table using SELECT..INTO
SELECT
age AS DummyField1,
lastname AS DummyField2
INTO #myTempTable
FROM DummyTable
To make these into global temporary tables, just replace (#) with (##)
| Is This Answer Correct ? | 15 Yes | 2 No |
What is use of except clause? How it differs from not in clause?
After creating the cube, if we added a new column to the oltp table then how you add this new attribute to the cube? : sql server analysis services, ssas
how to get max salary with employee number by using one select query and max function ??
i want to create procedure for create table in sql server 2005 for example create procedure create_table @table varchar(20) as create @table( id int, name char(20) ) but it will get error what is solution?
Where is localdb stored?
How to select some specific rows from a table in ms sql server?
What is a non equi join?
What is an sql server agent?
What are the properties of primary key?
What is the default fill factor value?
How to drop an existing stored procedure in ms sql server?
i have a table like this Eno ename 1 a 2 b 3 c i want to display ename and bossname from table hint boss is also an employee
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)