Re: Incorrect syntax near ':'



Veeru (Veeru@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
I am reading the query and the value from Xml file. I need to execute the
query using OLEDB.

my xml mesage contains

<DataRequest reqName="Example1">
<osql:ExportRequest xmlns:osql="sql"
connectionString="Provider=SQLNCLI;Server=DAESRV003\SQL_SERVER_2005;PLSQLRSet=1;Database=MI;UID=XT;PWD=aeseixt_133"
rowsToFetch="100" skipNullValues="true" explicitNulls="true"
targetNamespace="IS/1.0.0" processingMode="skip" dateTimeFormat="dmy">

<DataObject name="Sales_Force" namespace="Sales_Force">
<SQL sql="select * from team where team_id =:eid">
<param name="eid" value="105"/>
</SQL>
</DataObject>
</osql:ExportRequest>
</DataRequest>

when I run my program it is showing the following error

<Error><Code>80040e14</Code><Description><OLEDBErrors hr="80040e14"><Error
row="0" source="Microsoft SQL Native Client" Description="Statement(s) could
not be prepared." helpContext="0"
guid="{0C733A63-2A1C-11CE-ADE5-00AA0044773D}"/><Error row="0"
source="Microsoft SQL Native Client" Description="Incorrect syntax near ':'."
helpContext="0"
guid="{0C733A63-2A1C-11CE-ADE5-00AA0044773D}"/><UserMessage></UserMessage></OLEDBErrors></Description><Module>Export</Module><Message></Message><RequestId></RequestId></Error>The program

If I run the same using Oracle it goes fine.

Don't know where you found that : syntax. Just because it works with
an Oracle provider does not mean it's portable.

This form of sending an SQL statement in an XML document is nothing
that I am faimiliar with, but I would try one of @eid or ?. In the
first case you should probably say param name="@eid" as well.




--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Query training -- Complex queries
    ... > Update PositionsEOM ... Here you don't have a derived table, but a correlated subquery. ... UPDATE in Books Online. ... is not written for SQL Server. ...
    (microsoft.public.sqlserver.server)
  • Re: STORED PROCEDURE - passing table name as a parameter
    ... T-SQL, is that you get problems if the view definition does not fit into ... will need to query other system tables, for instance syscolumns. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Problem when changing Views
    ... There aree several reasons. ... I use neither of the tools, but I guess that Design View resubmits the ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: SQL 2005: Help files not valid?
    ... Please try the following instructions to remove and reinstall Books Online. ... If this doesn't solve the problem, we'll need to get the Visual Studio folks ... In Add or Remove Programs, select Microsoft SQL Server 2005, and then ... Complete the remaining steps in the Installation Wizard. ...
    (microsoft.public.sqlserver.setup)
  • Re: Nested Nodes in XML from a table
    ... > Well considering that many persons would be accessing a search engine; ... > who knows how many of them will be in the future acessing at the same ... > is much faster than accessing the actual sql server. ... I don't have Books Online 2005 on this machine, ...
    (comp.databases.ms-sqlserver)