Global temporary table

Source: Internet
Author: User

A global temporary table is a temporary table prefixed with '##' and visible to all sessions. Global temporary tables are generally used to share data with everyone. The following is an example of a global temporary table.

-- Global temporary table if object_id ('tempdb. DBO. # globals ', 'U') is not null drop table DBO. # globals; go -- create a global temporary table create table dbo. # globals (ID int not null, value nvarchar (50) not null, constraint pk_globals primary key (ID); -- insert data into the global temporary table into DBO. # globals (ID, value) values (1, 'A'); -- query the created global temporary table select * From DBO in the current session. # globals;

Query results:

To prove that the global temporary table is visible to other sessions, we open a new query window and query with the same query statement. We will find that the query results are the same.

 

Global temporary table

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.