Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 import from db1.table1 to db2.table2

Author  Topic 

peterpan23
Starting Member

3 Posts

Posted - 2010-12-29 : 04:21:34
hi

i rly tryed to find a thread ansering this question, but i didnt finde one.. sorry if i was just to stupid searching !

i would like to import some Adresses from one Database into the Adresses-Table from Database2. they are on the same SQL Server. can some1 tell me how to insert these, or at least tell me where i can see how i can?

thank u very much

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-12-29 : 04:27:32
Run in DB2

insert addresses
select *
from DB1..Addresses



==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

peterpan23
Starting Member

3 Posts

Posted - 2010-12-29 : 04:44:31
thank u, seems to work out. but now i got another question:
there is a intern number in this database. and for sure i cant import these adresses coz this number is the primary key. now i wanted to add to the numbers a number (+1000 or something).didnt work out?

update ADR_Adressen set InternNumber = + 500
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-12-29 : 04:47:29
update ADR_Adressen set InternNumber = InternNumber + 500
Better to do it as part of the insert though.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -