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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Another 'Insert INTO' question

Author  Topic 

REEPER
Yak Posting Veteran

53 Posts

Posted - 2007-01-19 : 15:33:04
How can I copy data from 1 database to another on an entirely differant machine. Here is what I have so far:

INSERT INTO TOPS_BOM_MASTER
MaterialNo, Plant, MaterialGroup, UoM, MaterialDescription, CommisionGroup, SalesOrg, GroupDescription)
tmpSql.Append("SELECT MaterialNo, Plant, MaterialGroup, UoM, MaterialDescription, CommisionGroup, SalesOrg, GroupDescription
FROM de1.DE1.dbo.TOPS_BOM_MASTER

The database being copied to is: whisql2k.WHWSMaster.dbo.TOPS_BOM_MASTER

MCP, MCSD

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-01-19 : 15:36:43
You would need to add a linked server to de1. Then you can use the four part naming convention to get to it:

INSERT INTO whisql2k.WHWSMaster.dbo.TOPS_BOM_MASTER
MaterialNo, Plant, MaterialGroup, UoM, MaterialDescription, CommisionGroup, SalesOrg, GroupDescription)
tmpSql.Append("SELECT MaterialNo, Plant, MaterialGroup, UoM, MaterialDescription, CommisionGroup, SalesOrg, GroupDescription
FROM TOPS_BOM_MASTER

You could also add a linked server to whisql2k and do this as well:

INSERT INTO TOPS_BOM_MASTER
MaterialNo, Plant, MaterialGroup, UoM, MaterialDescription, CommisionGroup, SalesOrg, GroupDescription)
tmpSql.Append("SELECT MaterialNo, Plant, MaterialGroup, UoM, MaterialDescription, CommisionGroup, SalesOrg, GroupDescription
FROM DE1.dbo.TOPS_BOM_MASTER

Tara Kizer
Go to Top of Page

REEPER
Yak Posting Veteran

53 Posts

Posted - 2007-01-19 : 15:40:12
how do you add a linked server?

MCP, MCSD
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-01-19 : 15:41:19
Please read up on linked servers in SQL Server Books Online. It is well documented in there.

Tara Kizer
Go to Top of Page

REEPER
Yak Posting Veteran

53 Posts

Posted - 2007-01-19 : 15:49:44
I found it in my SQL Sever Management tool - in the tree for adding linked servers - I'll give it a try.

MCP, MCSD
Go to Top of Page

REEPER
Yak Posting Veteran

53 Posts

Posted - 2007-01-19 : 16:33:40
that worked good - thx!

MCP, MCSD
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-01-19 : 16:45:15
sp_addlinkedserver

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -