user1700358
user1700358

Reputation: 11

Update table in one database from another table in different db (same sql instance)

Want to use SSIS - but still kind of new to SSIS. Can I do this without creating a flat file?

Upvotes: 1

Views: 3791

Answers (2)

Pondlife
Pondlife

Reputation: 16240

You haven't given many details, but assuming that you're talking about SQL Server, the easiest way is to use pure TSQL in an Execute SQL task. The documentation describes how to UPDATE one table from another, and instead of using two-part names (dbo.Table1) you can simply use three-part names (DB1.dbo.Table1):

update DB1.dbo.Table1
set Column1 = t2.Column2
from DB1.dbo.Table1 t1
join DB2.dbo.Table2 t2
on t1.JoinColumn = t2.JoinColumn
where...

Please always mention what database platform you're using (since SSIS is an ETL tool, we can't assume you're working with SQL Server), what version of SQL Server / SSIS you have (e.g. 2008R2) and what edition (e.g. Enterprise or Standard).

Upvotes: 1

Piotr Sobiegraj
Piotr Sobiegraj

Reputation: 1783

You don't need flat file.Use two connections: first for source db and second for destination db. Create one data flow with source that uses first connection and destination that uses second. Connect them and optionally add transformations between. Your question is too general to write more precise advice.

Upvotes: 1

Related Questions