Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Copying Between Databases Without Linked Servers?

 
   Database Help (Home) -> Programming RSS
Next:  Issue executing a package using the dtexec utilit..  
Author Message
SnapDive

External


Since: Jan 13, 2010
Posts: 4



(Msg. 1) Posted: Wed Jan 13, 2010 11:52 am
Post subject: Copying Between Databases Without Linked Servers?
Archived from groups: microsoft>public>sqlserver>programming (more info?)

I have a SQL Server 2005 machine called "Dest" and a 2008 machine
called "Source" and a 2008 machine called "Console". Each has the same
SQL account with appropriate permissions and rights on all 3 to do
anything.

Without using a linked server, how can I sit at "Console" and execute
a "select into" fromthe "Source" database to the "Dest" database?


Thanks.

 >> Stay informed about: Copying Between Databases Without Linked Servers? 
Back to top
Login to vote
Scott Morris

External


Since: Aug 28, 2003
Posts: 86



(Msg. 2) Posted: Wed Jan 13, 2010 12:48 pm
Post subject: Re: Copying Between Databases Without Linked Servers? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"SnapDive" wrote in message

>I have a SQL Server 2005 machine called "Dest" and a 2008 machine
> called "Source" and a 2008 machine called "Console". Each has the same
> SQL account with appropriate permissions and rights on all 3 to do
> anything.
>
> Without using a linked server, how can I sit at "Console" and execute
> a "select into" fromthe "Source" database to the "Dest" database?

You can't - assuming that the equivalent use of openquery is not allowed
either. There are many ways to transfer data, but your requirement to use
"select into" is the limiting factor here.

 >> Stay informed about: Copying Between Databases Without Linked Servers? 
Back to top
Login to vote
SnapDive

External


Since: Jan 13, 2010
Posts: 4



(Msg. 3) Posted: Wed Jan 13, 2010 1:06 pm
Post subject: Re: Copying Between Databases Without Linked Servers? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Then my requirements are too narrow then.

What is the "tightest" way to create a linked server temporarily and
then drop it at the end of the script?

I am open to not using "select into" if that is my problem. I really
need to do an insert and then update from one DB table to another
(same name, same column schema), so whatever will get me there without
having to leave the SSMS session in 'pure tsql' is cool.

Thanks.



On Wed, 13 Jan 2010 12:48:13 -0500, "Scott Morris"
wrote:

>"SnapDive" wrote in message
>
>>I have a SQL Server 2005 machine called "Dest" and a 2008 machine
>> called "Source" and a 2008 machine called "Console". Each has the same
>> SQL account with appropriate permissions and rights on all 3 to do
>> anything.
>>
>> Without using a linked server, how can I sit at "Console" and execute
>> a "select into" fromthe "Source" database to the "Dest" database?
>
>You can't - assuming that the equivalent use of openquery is not allowed
>either. There are many ways to transfer data, but your requirement to use
>"select into" is the limiting factor here.
>
 >> Stay informed about: Copying Between Databases Without Linked Servers? 
Back to top
Login to vote
Bob Barrows

External


Since: Jan 15, 2004
Posts: 4



(Msg. 4) Posted: Wed Jan 13, 2010 1:40 pm
Post subject: Re: Copying Between Databases Without Linked Servers? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Not sure why you need to add and drop it rpeatedly, but look up
sp_addlinkedserver and sp_dropserver in BOL

SnapDive wrote:
> Then my requirements are too narrow then.
>
> What is the "tightest" way to create a linked server temporarily and
> then drop it at the end of the script?
>
> I am open to not using "select into" if that is my problem. I really
> need to do an insert and then update from one DB table to another
> (same name, same column schema), so whatever will get me there without
> having to leave the SSMS session in 'pure tsql' is cool.
>
> Thanks.
>
>
>
> On Wed, 13 Jan 2010 12:48:13 -0500, "Scott Morris"
> wrote:
>
>> "SnapDive" wrote in message
>>
>>> I have a SQL Server 2005 machine called "Dest" and a 2008 machine
>>> called "Source" and a 2008 machine called "Console". Each has the
>>> same SQL account with appropriate permissions and rights on all 3
>>> to do anything.
>>>
>>> Without using a linked server, how can I sit at "Console" and
>>> execute a "select into" fromthe "Source" database to the "Dest"
>>> database?
>>
>> You can't - assuming that the equivalent use of openquery is not
>> allowed either. There are many ways to transfer data, but your
>> requirement to use "select into" is the limiting factor here.

--
HTH,
Bob Barrows
 >> Stay informed about: Copying Between Databases Without Linked Servers? 
Back to top
Login to vote
Scott Morris

External


Since: Aug 28, 2003
Posts: 86



(Msg. 5) Posted: Wed Jan 13, 2010 2:49 pm
Post subject: Re: Copying Between Databases Without Linked Servers? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"SnapDive" wrote in message

> Then my requirements are too narrow then.
>
> What is the "tightest" way to create a linked server temporarily and
> then drop it at the end of the script?
>
> I am open to not using "select into" if that is my problem. I really
> need to do an insert and then update from one DB table to another
> (same name, same column schema), so whatever will get me there without
> having to leave the SSMS session in 'pure tsql' is cool.

"Tightest"? "Without having to leave the SSMS session in 'pure tsql'"? I
don't really understand what you mean with these terms and phrases. The
biggest problem is that you are defining "how" you want to do something, and
not "what" you want to accomplish.

First, let's review something that you might be missing (or perhaps contains
a piece of information that isn't obvious to me).

You said (rephrasing a bit):
> I have a SQL Server 2005 machine called "Dest" and a 2008 machine
> called "Source" and a 2008 machine called "Console".
> How can I sit at "Console" and move data from "Source" to "Dest"?

The fact that you are physically at "Console" is mostly irrelevent from a
SSMS perspective. You can connect to any SQL Server from any physical point
in your network. The more important point is the server instance to which
you are connected (from within SSMS or any other application).

Based on your terms and usage, I get the impression that you are looking for
a rather simple set of steps to merge data - perhaps because there is some
unfamiliarity with sql server or tsql. Your comments also imply that this is
a temporary thing - while "script" implies that it will be done multiple
times. These facets of the issue will affect the possible solutions - you
may want to mull these over some more.

In any event, the SQL Server documentation is the first place to start.
There are tools provided by SQL Server for doing these things. Creating a
linked server is one option (even temporarily), but it may not be the best
option. The amount of data to be merged, the speed of the network, the
complexity of the rules involved in merging data all have an impact on the
selection of a solution. MS provides SSIS (sql server integration services)
to handle things of this type. There are also many ways to export data from
and import data to a database/table. SSIS can do this, as can bcp, bulk
insert, insert/openrowset. You should review the following (just paste it
into your browser url) BOL documentation to get an idea of their
capabilities.
ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_4deptrbl/html/50d19cab-1830-4f70-8df1-2450ce887805.htm
At the bottom of this page is a link to "Scenarios for bulk importing and
exporting data", which will lead you to the topic of "Copying data between
servers" (among others). All very good sources of information. Reading
that may help clarify / quantify your situation.

In BOL, some additional useful index topics:
openquery
openrowset
replication
importing data
exporting data

Perhaps now is a good time to stress the importance of a good disaster
recovery plan. If you lose or alter your data (and it is pretty easy to
do - trust me!), do you have a proper (and tested) backup strategy that will
allow you to recover? This is important when you are attempting to
move/merge data between databases and accidentally update every row with an
incorrectly written update statement (or delete statement).
 >> Stay informed about: Copying Between Databases Without Linked Servers? 
Back to top
Login to vote
Tibor Karaszi

External


Since: Jan 29, 2004
Posts: 1559



(Msg. 6) Posted: Wed Jan 13, 2010 4:25 pm
Post subject: Re: Copying Between Databases Without Linked Servers? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I suggest you check out the OPENROWSET() and OPENDATASOURCE() functions.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi



"SnapDive" wrote in message

> Then my requirements are too narrow then.
>
> What is the "tightest" way to create a linked server temporarily and
> then drop it at the end of the script?
>
> I am open to not using "select into" if that is my problem. I really
> need to do an insert and then update from one DB table to another
> (same name, same column schema), so whatever will get me there without
> having to leave the SSMS session in 'pure tsql' is cool.
>
> Thanks.
>
>
>
> On Wed, 13 Jan 2010 12:48:13 -0500, "Scott Morris"
> wrote:
>
>>"SnapDive" wrote in message
>>
>>>I have a SQL Server 2005 machine called "Dest" and a 2008 machine
>>> called "Source" and a 2008 machine called "Console". Each has the same
>>> SQL account with appropriate permissions and rights on all 3 to do
>>> anything.
>>>
>>> Without using a linked server, how can I sit at "Console" and execute
>>> a "select into" fromthe "Source" database to the "Dest" database?
>>
>>You can't - assuming that the equivalent use of openquery is not allowed
>>either. There are many ways to transfer data, but your requirement to use
>>"select into" is the limiting factor here.
>>
>
 >> Stay informed about: Copying Between Databases Without Linked Servers? 
Back to top
Login to vote
SnapDive

External


Since: Jan 13, 2010
Posts: 4



(Msg. 7) Posted: Thu Jan 14, 2010 10:57 am
Post subject: Re: Copying Between Databases Without Linked Servers? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks everyone for their input, I am set with what I need.


On Wed, 13 Jan 2010 11:52:59 -0500, SnapDive
wrote:

>I have a SQL Server 2005 machine called "Dest" and a 2008 machine
>called "Source" and a 2008 machine called "Console". Each has the same
>SQL account with appropriate permissions and rights on all 3 to do
>anything.
>
>Without using a linked server, how can I sit at "Console" and execute
>a "select into" fromthe "Source" database to the "Dest" database?
>
>
>Thanks.
>
 >> Stay informed about: Copying Between Databases Without Linked Servers? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
a quick way of copying table structure between databases - Is there any replacement for: SELECT * INTO DB2.dbo.Table FROM DB1.dbo.Table WHERE 1=2 that works with identity columns? In other words - I'm looking for a relatively simple code that can copy any table between two databases (the same server, sql..

getting stored procs to communicate with databases on othe.. - Ok, I've looked in my reference books and can't find this. I'm currently using code I've written on a database which communicates with tables within that database. Now, we're splitting databases. We'll have one for code, and another one for reporting....

MSSQL2000 and Linked Servers - Hi On a production system we haven't yet had the chance to update from MS SQL Server 2000 (v 8.00.2039 on Win2k3 SP2). I have, as dbadmin, a long time been using Linked Servers (with fixed account mapping) to a set of DB2 databases. Now we for the..

linked servers and system dsn - Hi, In SQL Server 2000 I have a linked server to a Progress database that currently works using a System DSN. However I created a new System DSN on the server with a different name but all of the exact same properties. When I create a new linked..

How to do a select statement from Linked servers. - I have two servers on my machine MDsync3 MDsync3\OFFICEMEDIC Select * from OfficeMedic.officeMedicData.patientInfo The statement above give me the correct Select Data. I'm trying to do a select statement from the MDsync3 instance I tried the followin...
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]