SQL cross-database transfer

Source: Internet
Author: User

The same structure.
INSERT INTO Database A.dbo.tablea
SELECT * FROM Database B.dbo.tablea

Other than that:
Nsert into DDD (Field 1, Field 2, Field 3 ...)
(
Select field 1, Field 2, Field 3 .... from AAA,BBB,CCC
)
The fields that you insert and the number of fields in the query are of the same type
As your library query is inserted
So add the library name before the table name. User Name
Insert INTO B. User. DDD (field 1, Field 2, Field 3 ...)
(
Select field 1, Field 2, Field 3 .... from A. User. aaa,a. user. bbb,a. User. CCC
)
If it is a SQL Server database, you can see the table user name in the left menu of Query Analyzer.
If you are operating under a library, you can omit the library name of the A library table. User name, same as B library table

Reprinted from: http://www.aspnetjia.com/Cont-128.html

SQL cross-database transfer

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.