Hi,
Would this sql be correct, I want to write a sp to insert into a table using tables from a remote server, how would I change it if I could'nt query the datasource directly:
EXEC sp_addlinkedserver 'Server',
N'SQL Server',
EXEC
sp_addlinkedsrvlogin 'Server', 'false', '', 'user', 'password'
GO
IF EXISTS (SELECT name FROM sysobjects WHERE name = N'NEW_PROC'
AND type = 'P')
DROP PROCEDURE dbo.NEW_PROC
GO
CREATE PROCEDURE NEW_PROC
AS
BEGIN
INSERT INTO TEMP_RESULTS(ID,COLUMNA,COLUMNB)
SELECT A.ID, A.COLUMNA, A.COLUMNB
FROM Server.Database.dbo.RESULT A
INNER JOIN
Server.Database.dbo.SAMPLE B ON
A.ID = B.ID
END
GRANT ALL ON dbo.NEW_PROC TO PUBLIC