BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Saving an ADO Result Set

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Jose
Guest





PostPosted: Fri Feb 04, 2005 11:50 am    Post subject: Saving an ADO Result Set Reply with quote



Hi,

I have to different servers with MSSQL 7 and i want to save in a new table
in the second server the result of a select query executed in the main
server. Is there a direct (and easy) way to do it?

Thanks for your help.


Back to top
Heinrich Braun
Guest





PostPosted: Fri Feb 04, 2005 9:04 pm    Post subject: Re: Saving an ADO Result Set Reply with quote



Hi,

an easy way is by linking a remote-server (may even be access/excel or
any other database-server):


--check "sp_addlinkedserverlogin" as well, you may need it, depending on
--user permissions


use master
go
-- CHECK IF REQUESTED SERVER(S) EXIST
if not exists (select * from master.dbo.sysservers where (srvname =
'MYSERVER2'))
begin
EXEC sp_addlinkedserver 'MYSERVER2', N'SQL Server'
end

--than do query with INTO
use mydatabase1
go
select * into MYSERVER2.dbo.mydatabse2.newtable from mytable1

--you may pack the serverlinking into a stored procedure
--thats it , you don't need an resultset first, just execute an ado
--command or query

hth
heinrich



Jose schrieb:
Quote:
Hi,

I have to different servers with MSSQL 7 and i want to save in a new table
in the second server the result of a select query executed in the main
server. Is there a direct (and easy) way to do it?

Thanks for your help.



Back to top
Jose
Guest





PostPosted: Mon Feb 07, 2005 8:27 am    Post subject: Re: Saving an ADO Result Set Reply with quote



heinrich,

Thanks for the response. It was really helpful.

Jose.


Back to top
Jose
Guest





PostPosted: Mon Feb 07, 2005 2:55 pm    Post subject: Re: Saving an ADO Result Set Reply with quote


Hi Heinrich,

The query analyzer says that my object has too many prefixes...

"Heinrich Braun" <heinrich.braun (AT) homagSPAMM (DOT) de> escribió en el mensaje
news:4203e333$1 (AT) newsgroups (DOT) borland.com...
Quote:
Hi,

an easy way is by linking a remote-server (may even be access/excel or
any other database-server):


--check "sp_addlinkedserverlogin" as well, you may need it, depending on
--user permissions


use master
go
-- CHECK IF REQUESTED SERVER(S) EXIST
if not exists (select * from master.dbo.sysservers where (srvname =
'MYSERVER2'))
begin
EXEC sp_addlinkedserver 'MYSERVER2', N'SQL Server'
end

--than do query with INTO
use mydatabase1
go
select * into MYSERVER2.dbo.mydatabse2.newtable from mytable1

--you may pack the serverlinking into a stored procedure
--thats it , you don't need an resultset first, just execute an ado
--command or query

hth
heinrich



Jose schrieb:
Hi,

I have to different servers with MSSQL 7 and i want to save in a new
table
in the second server the result of a select query executed in the main
server. Is there a direct (and easy) way to do it?

Thanks for your help.





Back to top
Heinrich Braun
Guest





PostPosted: Thu Feb 10, 2005 1:04 pm    Post subject: Re: Saving an ADO Result Set Reply with quote

Hi Jose,

sorry I was out of office for a few days.

can you post the sql-code, if your probelm still exists?

'Prefixes' is the servername.database.ower.table ...

you may spare it, if the commend 'use database' is used.

Heinrich



Jose schrieb:
Quote:
Hi Heinrich,

The query analyzer says that my object has too many prefixes...

"Heinrich Braun" <heinrich.braun (AT) homagSPAMM (DOT) de> escribió en el mensaje
news:4203e333$1 (AT) newsgroups (DOT) borland.com...

Hi,

an easy way is by linking a remote-server (may even be access/excel or
any other database-server):


--check "sp_addlinkedserverlogin" as well, you may need it, depending on
--user permissions


use master
go
-- CHECK IF REQUESTED SERVER(S) EXIST
if not exists (select * from master.dbo.sysservers where (srvname =
'MYSERVER2'))
begin
EXEC sp_addlinkedserver 'MYSERVER2', N'SQL Server'
end

--than do query with INTO
use mydatabase1
go
select * into MYSERVER2.dbo.mydatabse2.newtable from mytable1

--you may pack the serverlinking into a stored procedure
--thats it , you don't need an resultset first, just execute an ado
--command or query

hth
heinrich



Jose schrieb:

Hi,

I have to different servers with MSSQL 7 and i want to save in a new

table

in the second server the result of a select query executed in the main
server. Is there a direct (and easy) way to do it?

Thanks for your help.






Back to top
Heinrich Braun
Guest





PostPosted: Thu Feb 10, 2005 2:20 pm    Post subject: Re: Saving an ADO Result Set Reply with quote

Hi Jose

select * into MYSERVER2.dbo.mydatabse2.newtable from mytable1
--is wrong, my fault :-(


select * into MYSERVER2.mydatabse2.dbo.newtable from mytable1
-- is the correct syntax!

Heinrich



Jose schrieb:
Quote:
Hi Heinrich,

The query analyzer says that my object has too many prefixes...

"Heinrich Braun" <heinrich.braun (AT) homagSPAMM (DOT) de> escribió en el mensaje
news:4203e333$1 (AT) newsgroups (DOT) borland.com...

Hi,

an easy way is by linking a remote-server (may even be access/excel or
any other database-server):


--check "sp_addlinkedserverlogin" as well, you may need it, depending on
--user permissions


use master
go
-- CHECK IF REQUESTED SERVER(S) EXIST
if not exists (select * from master.dbo.sysservers where (srvname =
'MYSERVER2'))
begin
EXEC sp_addlinkedserver 'MYSERVER2', N'SQL Server'
end

--than do query with INTO
use mydatabase1
go
select * into MYSERVER2.dbo.mydatabse2.newtable from mytable1

--you may pack the serverlinking into a stored procedure
--thats it , you don't need an resultset first, just execute an ado
--command or query

hth
heinrich



Jose schrieb:

Hi,

I have to different servers with MSSQL 7 and i want to save in a new

table

in the second server the result of a select query executed in the main
server. Is there a direct (and easy) way to do it?

Thanks for your help.






Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.