EXEC sp_addlinkedserver 'Inkor','','SQLOLEDB','IP地址'
EXEC sp_addlinkedsrvlogin 'Inkor','false',NULL,'用户名','密码'
DECLARE InkorCurSor CURSOR FOR
SELECT B.Id AS ProClassID,A.URLaddress AS PanoPath,A.NewsTitle AS PanoTitle,A.Content AS PanoContent,70 AS PanoRegionID,SPicURL AS PreviewImg
FROM Inkor.qjjcms.dbo.NT_News AS A INNER JOIN Inkor.qjjcms.dbo.NT_News_Class AS B ON A.ClassID = B.ClassID WHERE A.ClassID = '375543576470' AND A.isRecyle = 0 AND A.URLaddress LIKE '%http%'OPEN InkorCurSor
DECLARE @InfoID VARCHAR(100),@ClassID INT,@SpecialID INT, VARCHAR(200),@PourUrl VARCHAR(200),@PicUrl VARCHAR(200),@DsContent VARCHAR(8000),@Content VARCHAR(8000)
FETCH NEXT FROM InkorCurSor INTO @ClassID,@PourUrl,@Title,@DsContent,@SpecialID,@Picurl
WHILE @@FETCH_STATUS = 0
BEGIN Insert INTO DataApp.dbo.PanoViews(ProTypeID,ProClassID,PanoPath,PanoTitle,PanoContent,PanoRegionID,PreviewImg) VALUES(1,@ClassID,@PourUrl,@Title,@DsContent,289,@PicUrl) FETCH NEXT FROM InkorCurSor INTO @ClassID,@PourUrl,@Title,@DsContent,@SpecialID,@Picurl END CLOSE InkorCurSor --释放资源 DEALLOCATE InkorCurSor