Database Creation Temp Table

Source: Internet
Author: User
Tags table name
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.