The table name is used with a # number, the temporary table is local, using two # #, the temporary table is global, after disconnecting SQL will automatically delete the temporary table
CREATE TABLE #a
(
ID int,
name varchar
INSERT INTO #a (id,name) The values (1, ' 123 ')
select * FROM #a
drop table #a
temporary table except for the name # Extra, the other operation is exactly the same as the normal table.
Tb_student is a built-in table, and we copy the contents of the Tb_student table to the Tb_lizi table via temporary table temp, which can be implemented using the following code: Use
mcf
SELECT * into #temp from Tb_student
SELECT *
to Tb_lizi disconnect the SQL connection and reconnect after execution (you can also exit sq and restart SQL) and discover Tb_ The content in the Lizi table is exactly the same as the content in the Tb_student table, replication is implemented, and we do not delete the temp table in code, but the temp table is not in the MCF database, because SQL automatically deletes the temp table when disconnected