Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF, 078274121, info0a ip, should prodicers of software_based services be held liable or not liable for economic injuries

Links

XODOX
Impressum

#1: Linked Server Error

Posted on 2008-04-16 23:09:30 by Jeff Crumbley

This is a multi-part message in MIME format.

------_=_NextPart_001_01C8A006.2986C0E6
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

To whom it may concern:

=20

I am running SQL Server on Windows 2003 R2 (32-bit) connecting to
Postgres on SCO Unix. I have installed the ODBC driver
(psqlodbc_08_03_0100) and can query the tables in Postgres using
OPENQUERY from SQL Server. Everything works great where this is
concerned.

=20

The issue I am having involves calling a Postgres Function from SQL
Server. The user ID that I am using to connect to Postgres is a
SuperUser and the function I created in Postgres is accepted without a
error (in pgAdmin III). =20

=20

The Function:

-------------------------------------------------------

CREATE OR REPLACE FUNCTION mssql_test()

RETURNS integer AS

$BODY$DECLARE

retval bigint;

BEGIN

retval:=3D(SELECT count(*) FROM dminvoice);

return retval;

END;$BODY$

LANGUAGE 'plpgsql' VOLATILE;

ALTER FUNCTION mssql_test() OWNER TO testuser;

GRANT EXECUTE ON FUNCTION mssql_test() TO public;

GRANT EXECUTE ON FUNCTION mssql_test() TO testuser;

=20

The way I am calling the function is as follows:

=20

Function Call:

-------------------------------------------------------

EXEC [PostgreSQL].dta.testuser.mssql_test (ODBC
Connection.Database.User.Function Name)

=20

The response I get from Postgres is:

=20

Error:

-------------------------------------------------------

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

Any help you can provide on this would be greatly appreciated.

=20

Thanks in advance,

=20

Jeff


------_=_NextPart_001_01C8A006.2986C0E6
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:x=3D"urn:schemas-microsoft-com:office:excel" =
xmlns:p=3D"urn:schemas-microsoft-com:office:powerpoint" =
xmlns:a=3D"urn:schemas-microsoft-com:office:access" =
xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" =
xmlns:s=3D"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" =
xmlns:rs=3D"urn:schemas-microsoft-com:rowset" xmlns:z=3D"#RowsetSchema" =
xmlns:b=3D"urn:schemas-microsoft-com:office:publisher" =
xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadsheet" =
xmlns:c=3D"urn:schemas-microsoft-com:office:component:spread sheet" =
xmlns:oa=3D"urn:schemas-microsoft-com:office:activation" =
xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:D=3D"DAV:" =
xmlns:x2=3D"http://schemas.microsoft.com/office/excel/2003/x ml" =
xmlns:ois=3D"http://schemas.microsoft.com/sharepoint/soap/oi s/" =
xmlns:dir=3D"http://schemas.microsoft.com/sharepoint/soap/di rectory/" =
xmlns:ds=3D"http://www.w3.org/2000/09/xmldsig#" =
xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint/dsp" =
xmlns:udc=3D"http://schemas.microsoft.com/data/udc" =
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" =
xmlns:sub=3D"http://schemas.microsoft.com/sharepoint/soap/20 02/1/alerts/"=
xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#" =
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" =
xmlns:sps=3D"http://schemas.microsoft.com/sharepoint/soap/" =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" =
xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile " =
xmlns:wf=3D"http://schemas.microsoft.com/sharepoint/soap/wor kflow/" =
xmlns:mver=3D"http://schemas.openxmlformats.org/markup-compa tibility/2006=
" xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns:mrels=3D"http://schemas.openxmlformats.org/package/200 6/relationshi=
ps" =
xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/service s/2006/types"=
=
xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/service s/2006/messag=
es" xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 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:export-only;}
@page 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>To whom it may concern:<o:p></o:p></p>

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

<p class=3DMsoNormal>I am running SQL Server on Windows 2003 R2 (32-bit)
connecting to Postgres on SCO Unix.&nbsp; I have installed the ODBC =
driver (psqlodbc_08_03_0100)
and can query the tables in Postgres using OPENQUERY from SQL =
Server.&nbsp;
Everything works great where this is concerned.<o:p></o:p></p>

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

<p class=3DMsoNormal>The issue I am having involves calling a Postgres =
Function
from SQL Server.&nbsp; The user ID that I am using to connect to =
Postgres is a SuperUser
and the function I created in Postgres is accepted without a error (in =
pgAdmin III).&nbsp;
<o:p></o:p></p>

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

<p class=3DMsoNormal>The Function:<o:p></o:p></p>

<p =
class=3DMsoNormal>------------------------------------------ -------------=
<o:p></o:p></p>

<p class=3DMsoNormal>CREATE OR REPLACE FUNCTION =
mssql_test()<o:p></o:p></p>

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

<p class=3DMsoNormal>$BODY$DECLARE<o:p></o:p></p>

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

<p class=3DMsoNormal>BEGIN<o:p></o:p></p>

<p =
class=3DMsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; retval:=3D(SELECT
count(*) FROM dminvoice);<o:p></o:p></p>

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

<p class=3DMsoNormal>END;$BODY$<o:p></o:p></p>

<p class=3DMsoNormal>&nbsp; LANGUAGE 'plpgsql' VOLATILE;<o:p></o:p></p>

<p class=3DMsoNormal>ALTER FUNCTION mssql_test() OWNER TO =
testuser;<o:p></o:p></p>

<p class=3DMsoNormal>GRANT EXECUTE ON FUNCTION mssql_test() TO =
public;<o:p></o:p></p>

<p class=3DMsoNormal>GRANT EXECUTE ON FUNCTION mssql_test() TO =
testuser;<o:p></o:p></p>

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

<p class=3DMsoNormal>The way I am calling the function is as =
follows:<o:p></o:p></p>

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

<p class=3DMsoNormal>Function Call:<o:p></o:p></p>

<p =
class=3DMsoNormal>------------------------------------------ -------------=
<o:p></o:p></p>

<p class=3DMsoNormal>EXEC [PostgreSQL].dta.testuser.mssql_test =
&nbsp;&nbsp;(ODBC
Connection.Database.User.Function Name)<o:p></o:p></p>

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

<p class=3DMsoNormal>The response I get from Postgres is:<o:p></o:p></p>

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

<p class=3DMsoNormal>Error:<o:p></o:p></p>

<p =
class=3DMsoNormal>------------------------------------------ -------------=
<o:p></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>Any help you can provide on this would be greatly
appreciated.<o:p></o:p></p>

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

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

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

<p class=3DMsoNormal>Jeff<o:p></o:p></p>

</div>

</body>

</html>

------_=_NextPart_001_01C8A006.2986C0E6--

Report this message

#2: Re: Linked Server Error

Posted on 2008-04-16 23:58:04 by Hiroshi Saito

Hi.

In it, "AS" key word was an indispensable reason and a problem. However, it becomes possible because it was equipped from version8.4 of server.
See,
http://winpg.jp/~saito/psqlODBC/SQLServer_linkserver_Postgre SQL2.png

Regards,
Hiroshi Saito

"Jeff Crumbley"
>To whom it may concern:
>
>
>
>I am running SQL Server on Windows 2003 R2 (32-bit) connecting to
>Postgres on SCO Unix. I have installed the ODBC driver
>(psqlodbc_08_03_0100) and can query the tables in Postgres using
>OPENQUERY from SQL Server. Everything works great where this is
>concerned.
>
>
>
>The issue I am having involves calling a Postgres Function from SQL
>Server. The user ID that I am using to connect to Postgres is a
>SuperUser and the function I created in Postgres is accepted without a
>error (in pgAdmin III).
>
>
>
>The Function:
>
>-------------------------------------------------------
>
>CREATE OR REPLACE FUNCTION mssql_test()
>
> RETURNS integer AS
>
>$BODY$DECLARE
>
> retval bigint;
>
>BEGIN
>
> retval:=(SELECT count(*) FROM dminvoice);
>
> return retval;
>
>END;$BODY$
>
> LANGUAGE 'plpgsql' VOLATILE;
>
>ALTER FUNCTION mssql_test() OWNER TO testuser;
>
>GRANT EXECUTE ON FUNCTION mssql_test() TO public;
>
>GRANT EXECUTE ON FUNCTION mssql_test() TO testuser;
>
>
>
>The way I am calling the function is as follows:
>
>
>
>Function Call:
>
>-------------------------------------------------------
>
>EXEC [PostgreSQL].dta.testuser.mssql_test (ODBC
>Connection.Database.User.Function Name)
>
>
>
>The response I get from Postgres is:
>
>
>
>Error:
>
>-------------------------------------------------------
>
>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'.
>
>
>
>Any help you can provide on this would be greatly appreciated.
>
>
>
>Thanks in advance,
>
>
>
>Jeff
>


--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Report this message