Home All Groups Group Topic Archive Search About

How To Move A Database Table

Author
22 Jun 2006 2:49 PM
JLuv
I want to SELECT data from one database table and INSERT it to another
table on a second SQL Server in C# ADO.NET. Where can I find
information on how to do this?

Author
22 Jun 2006 2:55 PM
Tracy McKibben
JLuv wrote:
> I want to SELECT data from one database table and INSERT it to another
> table on a second SQL Server in C# ADO.NET. Where can I find
> information on how to do this?
>

Create a linked server on Server A that points to Server B, then execute
the following on Server A:

SELECT *
INTO ServerB.dbname.dbo.tablename
FROM dbname.dbo.tablename
Author
22 Jun 2006 4:24 PM
JLuv
Tracy McKibben wrote:
> JLuv wrote:
> > I want to SELECT data from one database table and INSERT it to another
> > table on a second SQL Server in C# ADO.NET. Where can I find
> > information on how to do this?
> >
>
> Create a linked server on Server A that points to Server B, then execute
> the following on Server A:
>
> SELECT *
> INTO ServerB.dbname.dbo.tablename
> FROM dbname.dbo.tablename

Thanks for the linked server idea. It worked like a charm. I didn't use
that example as is, I had to use OPENQUERY() like this...

INSERT INTO databaseA.dbo.myTable (firstName, lastName)
SELECT firstName, lastName
FROM OPENQUERY(SERVERB, 'SELECT firstName, lastName FROM
databaseB.dbo.directory')

AddThis Social Bookmark Button