Question

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!

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top