Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Odbc > Call Postgres f...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 2344 of 2384
Post > Topic >>

Call Postgres function from Linked Server

by jeffc@[EMAIL PROTECTED] ("Jeff Crumbley") Apr 17, 2008 at 09:51 AM

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 Hiro**** 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

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
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">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @[EMAIL PROTECTED]
"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@[EMAIL PROTECTED]
 15 5 2 2 2 4 3 2 4;}
@[EMAIL PROTECTED]
"Brush Script MT";
	panose-1:3 6 8 2 4 4 6 7 3 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
..MsoChpDefault
	{mso-style-type:ex****t-only;}
@[EMAIL PROTECTED]
 Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal>Not to be repetitive but I think my approach on =
this has
changed from yesterday.<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Using the Postgres<span =
style=3D'font-family:"Arial","sans-serif"'>
</span>ODBC driver (psqlodbc_08_03_0100) on windows, how do I pass the =
command
to execute a Function on another machine?&nbsp; <o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>I am currently trying to execute the Function =
directly from
SQL Server Query Manager like this &#8220;EXEC
[PostgreSQL].dta.testuser.mssql_test&#8221; but get an error =
stating:<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>OLE DB provider &quot;MSDASQL&quot; for linked =
server
&quot;PostgreSQL&quot; returned message &quot;ERROR: syntax error at or =
near
&quot;1&quot;;<o:p></o:p></p>

<p class=3DMsoNormal>Error while executing the =
query&quot;.<o:p></o:p></p>

<p class=3DMsoNormal>Msg 7212, Level 17, State 1, Line 1<o:p></o:p></p>

<p class=3DMsoNormal>Could not execute procedure 'mssql_test' on remote =
server
'PostgreSQL'.<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>After corresponding with Hiro**** 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.<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>As a potential fix I thought using OPENQUERY might =
work but I
don&#8217;t know the equivalent syntax to &#8220;EXEC
[PostgreSQL].dta.testuser.mssql_test&#8221; to use to call a Function =
using
OPENQUERY.<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Any help anyone can provide would be =
appreciated.<o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Thanks, <o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><span style=3D'font-size:14.0pt;font-family:"Brush =
Script MT"'>JeffCrumble</span><o:p></o:p></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>

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




 1 Posts in Topic:
Call Postgres function from Linked Server
jeffc@[EMAIL PROTECTED]   2008-04-17 09:51:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 6:55:55 CDT 2008.