Cari Blog Ini

10 Juni 2010

IT - SQL Server - Guide for Copying Data in Table From Another Server SQL Server 2000

/*
FOR : SELECT DATA IN TABLE EMPLOYEE FROM ANOTHER SERVER in SQL SERVER 2000
*/

--1.
SELECT a.*
FROM OPENROWSET
('SQLOLEDB','IT104';'sa';'password',
'select * from pubs.dbo.employee') AS a
WHERE fname='Ann'



--2.
SELECT a.*
into #TempTabIT104Test01
FROM OPENROWSET
('SQLOLEDB','IT104';'sa';'password',
'exec pubs.dbo.reptq3 1000000, 200000, ''COOK'' '
) AS a
SELECT * FROM #TempTabIT104Test01
DROP TABLE #TempTabIT104Test01


--3.
SELECT a.*
into #TempTabIT104Test01
FROM OPENROWSET
('SQLOLEDB','IT104';'sa';'password',
'exec pubs.dbo.reptq3 1000000, 500000, ''COOK'' '
) AS a
WHERE title_id='MC3021'
SELECT * FROM #TempTabIT104Test01
DROP TABLE #TempTabIT104Test01