Re: Saving an ADO Result Set
From: Heinrich Braun (heinrich.braun_at_homagSPAMM.de)
Date: 02/04/05
- Previous message: Mars: "Connection to access table on web"
- In reply to: Jose: "Saving an ADO Result Set"
- Next in thread: Jose: "Re: Saving an ADO Result Set"
- Reply: Jose: "Re: Saving an ADO Result Set"
- Reply: Jose: "Re: Saving an ADO Result Set"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 04 Feb 2005 22:04:27 +0100
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.
>
>
- Previous message: Mars: "Connection to access table on web"
- In reply to: Jose: "Saving an ADO Result Set"
- Next in thread: Jose: "Re: Saving an ADO Result Set"
- Reply: Jose: "Re: Saving an ADO Result Set"
- Reply: Jose: "Re: Saving an ADO Result Set"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|