2

I am trying to access a remote function from a SELECT clause (lets call it view clause).

The problem is I can't use OPENQUERY and do a JOIN because I need to send a value from the view clause to the remote function. OPENQUERY doesn't allow variables.

I can't use EXEC to create a dynamic SQL query because it will not work with my view clause.

I cant't move the remote function to the local server, I can't create new functions in the local server at all.

The whole thing is actually very frustrating, is this even possible to solve?

Example code:

 SELECT [col1],[col2],[col3],RemoteServerFunction([col1]) FROM [tbl1] WHERE
    [col2] = X

Thanks in advance!

AdamG
  • 55
  • 5

1 Answers1

1

Sorry, But its True.

Here's the official word. You cannot call a UDF in this way.

http://connect.microsoft.com/SQLServer/feedback/details/276758/remote-table-valued-function-calls-are-not-allowed

Romesh
  • 2,291
  • 3
  • 24
  • 47
  • 1
    Thank you! I will have to think of a new way to solve this problem. Maybe by running the query on the linked server instead of the local and use the local server as a linked one. – AdamG Jul 01 '13 at 13:52