Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / March 2008

Tip: Looking for answers? Try searching our database.

Insert into 2 diferents dbs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paulo - 07 Mar 2008 17:16 GMT
Hi, I have 2 database on sql 2005

EQUIBRAS
HUB

How can I do a insert from EQUIBRAS.uf_codigos table to HUB? The table name
is: uf_codigos

Both are identical...

Thanks a lot!
Aaron Bertrand [SQL Server MVP] - 07 Mar 2008 17:26 GMT
INSERT HUB.dbo.uf_codigos(column_list) SELECT column_list FROM
EQUIBRAS.dbo.uf_codigos <where...>
?

> Hi, I have 2 database on sql 2005
>
[quoted text clipped - 7 lines]
>
> Thanks a lot!
Plamen Ratchev - 07 Mar 2008 17:32 GMT
You can do:

INSERT INTO HUB.dbo.uf_codigos (<column_list>)
SELECT <column_list> FROM EQUIBRAS.dbo.uf_codigos
WHERE ....

In the above replace <column_list> with your columns, and you may need to
replace 'dbo' with correct schema name if the tables are in different
schema. The WHERE is not necessary if you will be inserting all rows.

HTH,

Plamen Ratchev
http://www.SQLStudio.com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.