Home > database >  How to use SQL to a database of a list of the data is inserted into another database table
How to use SQL to a database of a list of the data is inserted into another database table

Time:09-30

How to use SQL to a database of a list of the data is inserted into another database table

CodePudding user response:

Use data pipeline much simple

CodePudding user response:

Insert into t1 select * from shujuku1. Dbo. T2;

CodePudding user response:

 
create links - serverThe exec sp_addlinkedserver 'srv_lnk', ' 'and' SQLOLEDB ', 'remote server name or IP address'
Exec sp_addlinkedsrvlogin 'srv_lnk', 'false', null, 'user name' and 'password'
Go

- query example
Select * from srv_lnk. Database name. The dbo. Table name

- import the sample
Select * into table from srv_lnk. The database name. Dbo. Table name

- later no longer use delete link server
The exec sp_dropserver 'srv_lnk', 'droplogins'
Go

- if only temporary access, can directly use openrowset
- query example
Select * from openrowset (' SQLOLEDB '
SQL server name, ' '; 'user name'; 'password'
, the database name. Dbo. Table name)


- import the sample
Select * into table from openrowset (' SQLOLEDB '
SQL server name, ' '; 'user name'; 'password'
, the database name. Dbo. Table name)

CodePudding user response:

refer to the second floor wfpp8008 response:
insert into t1 select * from shujuku1. The dbo. T2;
this method applies only to the target and the source database on the same DBMS

CodePudding user response:

Use data pipeline

CodePudding user response:

Agree with data pipeline

CodePudding user response:

Does this data pipeline is most suited to drop

CodePudding user response:

Sdhylj method works, using line in your SQL directly, not necessarily with PB, we will involve two, each other to write data in the database is to use this method, very the canal USES,

CodePudding user response:

Insert into table2 select * from database. Table1

CodePudding user response:

Recommend the use of data pipeline, the reason is to write directly to SQL database restrictions, at the SQL level, different types of the method to realize database,

CodePudding user response:

Mark, learn and pick up points

CodePudding user response:

The
reference 3 floor sdhylj response:
SQL code
Create links - server
The exec sp_addlinkedserver 'srv_lnk', ' 'and' SQLOLEDB ', 'remote server name or IP address'
Exec sp_addlinkedsrvlogin 'srv_lnk', 'false', null, 'user name' and 'password'
Go

- query example
Select *...

Good job!
  • Related