Query table containing spatial datatype over linked server

By admin - Last updated: Saturday, September 22, 2012 - Save & Share - Leave a Comment

If the target table containing column with spatial datatype, and you like to do the following query,

SELECT * FROM [LinkedServerName].[DatabaseName].dbo.MyPolygon

it will return

Objects exposing columns with CLR types are not allowed in distributed queries. Please use a pass-through query to access remote object

The work around is

SELECT * FROM OPENQUERY([LinkedServerName], ‘SELECT * FROM [DatabaseName].dbo.MyPolygon’)

Posted in SQL • • Top Of Page

Write a comment

Captcha: × 6 = fifty four