Home All Groups Group Topic Archive Search About

URGENT: Replication via T-SQL

Author
12 May 2005 2:45 PM
Lisa Pearlson
Hi,

I need to transfer a database from MSDE to SQL Server.
I can use T-SQL to detach a database, copy the .mdf and .ldf files to
another server and re-attach them there, but I do not want to use the Import
and Export Data (via Enterprise Manager) if possible.
I need this to be as easy as possible, using a T-SQL script preferably.
Also, this is possibly a live system so that detatching the database may not
be an option.

For this reason, I would like to import data.

This is the situation:

SQLSERVER  (IP: 10.0.0.1, using mixed authentication)
MSDESERVER (IP: 10.0.0.2, using sql server authentication, 'sa' with
password 'xxx')

MSDESERVER contains the data to be transferred to SQLSERVER

I wish to go into SQL SERVER, perform T-SQL from there to IMPORT all data
FROM MSDESERVER (not a problem if I copy tables, views and triggers too, but
data only would be sufficient since the database structure already exists on
SQL_SERVER.)

Is this possible using T-SQL only?
If not, what is the easiest way to transfer data? There are many ways using
import wizard, with lots of options, which makes it too complex. Currently
the most easy way seems to be detach the database, copy files and reattach
them, but I prefer to do it 'live', and not risking losing data at the
source.

Lisa

Author
12 May 2005 3:17 PM
Sarav
If you want to do this One time - May be you can just do the backup &
restore

if you like to access the MSDE database through TSQL, How about Linked
Server then query the MSDE database through TSQL.

-regards,
Sarav...

Show quote
"Lisa Pearlson" <no@spam.plz> wrote in message
news:OrSG3EwVFHA.1044@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I need to transfer a database from MSDE to SQL Server.
> I can use T-SQL to detach a database, copy the .mdf and .ldf files to
> another server and re-attach them there, but I do not want to use the
> Import and Export Data (via Enterprise Manager) if possible.
> I need this to be as easy as possible, using a T-SQL script preferably.
> Also, this is possibly a live system so that detatching the database may
> not be an option.
>
> For this reason, I would like to import data.
>
> This is the situation:
>
> SQLSERVER  (IP: 10.0.0.1, using mixed authentication)
> MSDESERVER (IP: 10.0.0.2, using sql server authentication, 'sa' with
> password 'xxx')
>
> MSDESERVER contains the data to be transferred to SQLSERVER
>
> I wish to go into SQL SERVER, perform T-SQL from there to IMPORT all data
> FROM MSDESERVER (not a problem if I copy tables, views and triggers too,
> but data only would be sufficient since the database structure already
> exists on SQL_SERVER.)
>
> Is this possible using T-SQL only?
> If not, what is the easiest way to transfer data? There are many ways
> using import wizard, with lots of options, which makes it too complex.
> Currently the most easy way seems to be detach the database, copy files
> and reattach them, but I prefer to do it 'live', and not risking losing
> data at the source.
>
> Lisa
>
Author
12 May 2005 4:38 PM
Lisa Pearlson
How do I link server?

Would that allow me to do stuff like

INSERT INTO [newserver].newdatabase.dbo.sometable
SELECT * FROM [oldserver].olddatabase.dbo.sometable

?

Lisa

Show quote
"Sarav" <sa***@sqlservertips.com> wrote in message
news:u1iwXXwVFHA.3716@TK2MSFTNGP12.phx.gbl...
> If you want to do this One time - May be you can just do the backup &
> restore
>
> if you like to access the MSDE database through TSQL, How about Linked
> Server then query the MSDE database through TSQL.
>
> -regards,
> Sarav...
>
> "Lisa Pearlson" <no@spam.plz> wrote in message
> news:OrSG3EwVFHA.1044@TK2MSFTNGP10.phx.gbl...
>> Hi,
>>
>> I need to transfer a database from MSDE to SQL Server.
>> I can use T-SQL to detach a database, copy the .mdf and .ldf files to
>> another server and re-attach them there, but I do not want to use the
>> Import and Export Data (via Enterprise Manager) if possible.
>> I need this to be as easy as possible, using a T-SQL script preferably.
>> Also, this is possibly a live system so that detatching the database may
>> not be an option.
>>
>> For this reason, I would like to import data.
>>
>> This is the situation:
>>
>> SQLSERVER  (IP: 10.0.0.1, using mixed authentication)
>> MSDESERVER (IP: 10.0.0.2, using sql server authentication, 'sa' with
>> password 'xxx')
>>
>> MSDESERVER contains the data to be transferred to SQLSERVER
>>
>> I wish to go into SQL SERVER, perform T-SQL from there to IMPORT all data
>> FROM MSDESERVER (not a problem if I copy tables, views and triggers too,
>> but data only would be sufficient since the database structure already
>> exists on SQL_SERVER.)
>>
>> Is this possible using T-SQL only?
>> If not, what is the easiest way to transfer data? There are many ways
>> using import wizard, with lots of options, which makes it too complex.
>> Currently the most easy way seems to be detach the database, copy files
>> and reattach them, but I prefer to do it 'live', and not risking losing
>> data at the source.
>>
>> Lisa
>>
>
>
Author
13 May 2005 6:06 AM
Sarav
Please Read the BookOnline Section
>Administering SQL Server
>>> Managing Servers
>>>>> Configuring Linked Servers


You will create the Linked server at the New server for Old server.
after creating the linked server you can query the old server database from
new server like

Select * from [old Server].Pubs.dbo.Employee

regards,
Sarav...

Show quote
"Lisa Pearlson" <no@spam.plz> wrote in message
news:uUbvoDxVFHA.3584@TK2MSFTNGP10.phx.gbl...
> How do I link server?
>
> Would that allow me to do stuff like
>
> INSERT INTO [newserver].newdatabase.dbo.sometable
> SELECT * FROM [oldserver].olddatabase.dbo.sometable
>
> ?
>
> Lisa
>
> "Sarav" <sa***@sqlservertips.com> wrote in message
> news:u1iwXXwVFHA.3716@TK2MSFTNGP12.phx.gbl...
>> If you want to do this One time - May be you can just do the backup &
>> restore
>>
>> if you like to access the MSDE database through TSQL, How about Linked
>> Server then query the MSDE database through TSQL.
>>
>> -regards,
>> Sarav...
>>
>> "Lisa Pearlson" <no@spam.plz> wrote in message
>> news:OrSG3EwVFHA.1044@TK2MSFTNGP10.phx.gbl...
>>> Hi,
>>>
>>> I need to transfer a database from MSDE to SQL Server.
>>> I can use T-SQL to detach a database, copy the .mdf and .ldf files to
>>> another server and re-attach them there, but I do not want to use the
>>> Import and Export Data (via Enterprise Manager) if possible.
>>> I need this to be as easy as possible, using a T-SQL script preferably.
>>> Also, this is possibly a live system so that detatching the database may
>>> not be an option.
>>>
>>> For this reason, I would like to import data.
>>>
>>> This is the situation:
>>>
>>> SQLSERVER  (IP: 10.0.0.1, using mixed authentication)
>>> MSDESERVER (IP: 10.0.0.2, using sql server authentication, 'sa' with
>>> password 'xxx')
>>>
>>> MSDESERVER contains the data to be transferred to SQLSERVER
>>>
>>> I wish to go into SQL SERVER, perform T-SQL from there to IMPORT all
>>> data FROM MSDESERVER (not a problem if I copy tables, views and triggers
>>> too, but data only would be sufficient since the database structure
>>> already exists on SQL_SERVER.)
>>>
>>> Is this possible using T-SQL only?
>>> If not, what is the easiest way to transfer data? There are many ways
>>> using import wizard, with lots of options, which makes it too complex.
>>> Currently the most easy way seems to be detach the database, copy files
>>> and reattach them, but I prefer to do it 'live', and not risking losing
>>> data at the source.
>>>
>>> Lisa
>>>
>>
>>
>
>
Author
31 May 2005 10:39 PM
Thomas
Try www.sqlscripter.com to do this.

Thomas

Show quote
"Lisa Pearlson" wrote:

> Hi,
>
> I need to transfer a database from MSDE to SQL Server.
> I can use T-SQL to detach a database, copy the .mdf and .ldf files to
> another server and re-attach them there, but I do not want to use the Import
> and Export Data (via Enterprise Manager) if possible.
> I need this to be as easy as possible, using a T-SQL script preferably.
> Also, this is possibly a live system so that detatching the database may not
> be an option.
>
> For this reason, I would like to import data.
>
> This is the situation:
>
> SQLSERVER  (IP: 10.0.0.1, using mixed authentication)
> MSDESERVER (IP: 10.0.0.2, using sql server authentication, 'sa' with
> password 'xxx')
>
> MSDESERVER contains the data to be transferred to SQLSERVER
>
> I wish to go into SQL SERVER, perform T-SQL from there to IMPORT all data
> FROM MSDESERVER (not a problem if I copy tables, views and triggers too, but
> data only would be sufficient since the database structure already exists on
> SQL_SERVER.)
>
> Is this possible using T-SQL only?
> If not, what is the easiest way to transfer data? There are many ways using
> import wizard, with lots of options, which makes it too complex. Currently
> the most easy way seems to be detach the database, copy files and reattach
> them, but I prefer to do it 'live', and not risking losing data at the
> source.
>
> Lisa
>
>
>

AddThis Social Bookmark Button