Call Postgres function from Linked Server

Call Postgres function from Linked Server

am 17.04.2008 16:51:07 von Jeff Crumbley

This is a multi-part message in MIME format.

------_=_NextPart_001_01C8A09A.77823CF4
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Not to be repetitive but I think my approach on this has changed from
yesterday.

=20

Using the Postgres ODBC driver (psqlodbc_08_03_0100) on windows, how do
I pass the command to execute a Function on another machine? =20

=20

I am currently trying to execute the Function directly from SQL Server
Query Manager like this "EXEC [PostgreSQL].dta.testuser.mssql_test" but
get an error stating:

=20

OLE DB provider "MSDASQL" for linked server "PostgreSQL" returned
message "ERROR: syntax error at or near "1";

Error while executing the query".

Msg 7212, Level 17, State 1, Line 1

Could not execute procedure 'mssql_test' on remote server 'PostgreSQL'.

=20

After corresponding with Hiroshi yesterday I now understand that the
error is due to SQL Server trying to interpret the function call before
it is handed off to ODBC, resulting in the error.

=20

As a potential fix I thought using OPENQUERY might work but I don't know
the equivalent syntax to "EXEC [PostgreSQL].dta.testuser.mssql_test" to
use to call a Function using OPENQUERY.

=20

Any help anyone can provide would be appreciated.

=20

Thanks,=20

=20

JeffCrumble

=20


------_=_NextPart_001_01C8A09A.77823CF4
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">









Not to be repetitive but I think my approach on =
this has
changed from yesterday.



 



Using the Postgres style=3D'font-family:"Arial","sans-serif"'>
ODBC driver (psqlodbc_08_03_0100) on windows, how do I pass the =
command
to execute a Function on another machine? 



 



I am currently trying to execute the Function =
directly from
SQL Server Query Manager like this “EXEC
[PostgreSQL].dta.testuser.mssql_test” but get an error =
stating:



 



OLE DB provider "MSDASQL" for linked =
server
"PostgreSQL" returned message "ERROR: syntax error at or =
near
"1";



Error while executing the =
query".



Msg 7212, Level 17, State 1, Line 1



Could not execute procedure 'mssql_test' on remote =
server
'PostgreSQL'.



 



After corresponding with Hiroshi yesterday I now =
understand
that the error is due to SQL Server trying to interpret the function =
call
before it is handed off to ODBC, resulting in the error.



 



As a potential fix I thought using OPENQUERY might =
work but I
don’t know the equivalent syntax to “EXEC
[PostgreSQL].dta.testuser.mssql_test” to use to call a Function =
using
OPENQUERY.



 



Any help anyone can provide would be =
appreciated.



 



Thanks,



 



Script MT"'>JeffCrumble



 









------_=_NextPart_001_01C8A09A.77823CF4--