Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

upadate database1.table1 wirh values from database2.table1

upadate database1.table1 wirh values from database2.table1
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image


Create a linked database then you can use this format

insert into database1.dbo.table1
select * from database2.dbo.table2
Avatar of rgb192

ASKER

Invalid object name database1.dbo.table1.    Where table1 is the new table on the first database
sorry

You have to use the server name

insert into [server1].[database1].[dbo].[table1]
select * from table2
Avatar of rgb192

ASKER

use database2
insert into server.database.dbo.orderitems12
select * from orderitems

Msg 8101, Level 16, State 1, Line 1
An explicit value for the identity column in table 'server.database.dbo.orderitems12' can only be specified when a column list is used and IDENTITY_INSERT is ON.


table orderitems123 has not be created

use database2
insert into purchase.ow1222.dbo.orderitems123
select * from orderitems
Invalid object name 'database.dbo.orderitems123'.
ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

thanks