Transfer data is SqlServer

General discussion forum about all databases other than SqlBase.
FRBhote
India
Posts: 2201
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Transfer data is SqlServer

Post by FRBhote » 26 Feb 2013, 14:32

In Sqlbase if I want to transfer data from one location to another I do:

CREATE VIEW X AS SELECT * FROM table WHERE ...;
UNLOAD SQL X.SQL X;

and in another database:

LOAD SQL X.SQL;

Simple. Can someone advise me how to do the same in MS SqlServer?

RainerE
Germany
Posts: 2165
Joined: 27 Apr 2021, 12:40
Location: Germany

Re: Transfer data is SqlServer

Post by RainerE » 26 Feb 2013, 15:21

In SqlServer you can address 2 dabases in a single select.
For example:

Code: Select all

insert into [Test].[dbo].[Test] (col1)
  select Name from [PROD].[dbo].[Customer]
This inserts into database TEST into table Test into Column col1 the values from database PROD from table Customer and column Name.

Regards,
Rainer

FRBhote
India
Posts: 2201
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Transfer data is SqlServer

Post by FRBhote » 26 Feb 2013, 15:27

Actually, one database is at a remote location and I usually mail the commands to that guy who runs it & sends me the file. Looking for something similar.

RainerE
Germany
Posts: 2165
Joined: 27 Apr 2021, 12:40
Location: Germany

Re: Transfer data is SqlServer

Post by RainerE » 26 Feb 2013, 17:42

Hi Feroz,
don't know, if there is a thing like 'Unload'.
But what about:

Code: Select all

create view Test as select Name from Agent
select 'insert into NewTable (NewCol) values ' + Name from test
At your side you can create the Table 'NewTable' and run all those insert statements.


And there seems to be a tool called bcp to transfer data from one Sql Server to another.

Regars,
Rainer

FRBhote
India
Posts: 2201
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Transfer data is SqlServer

Post by FRBhote » 27 Feb 2013, 16:41

Thanks, I checked out bcp and it seems to be the real thing.

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests