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