You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Vadim Pesochinskiy (JIRA)" <ib...@incubator.apache.org> on 2005/03/07 23:22:52 UTC

[jira] Commented: (IBATIS-85) Textual substitution for parameterized queries

     [ http://issues.apache.org/jira/browse/IBATIS-85?page=comments#action_60389 ]
     
Vadim Pesochinskiy commented on IBATIS-85:
------------------------------------------

I thought I would not be first to discover something like this. I read the doc entirely, but I did not catch this. Sorry for the trouble.

> Textual substitution for parameterized queries
> ----------------------------------------------
>
>          Key: IBATIS-85
>          URL: http://issues.apache.org/jira/browse/IBATIS-85
>      Project: iBatis for Java
>         Type: New Feature
>   Components: SQL Maps
>     Versions: 2.0.9b
>  Environment: SQL Server 2000, Win XP, Tomcat, JDK 1.4
>     Reporter: Vadim Pesochinskiy

>
> Problem Description:
> Unable to execute parameterized query using SQL Server TOP keyword. TOP allows you to return the specified number of rows from a result set.
> Query below fails with SQLException: Line 1: Incorrect syntax near '@P1'.
>   <select id="getRecentAlerts.sqlserver" resultMap="alertResult" parameterClass="int">
>       SELECT TOP #value# * 
>       FROM ods_exception_alert 
>       ORDER BY alert_time DESC
>   </select>
> This one executes OK (replaced "value" for troublshooting).
>   <select id="getRecentAlerts.sqlserver" resultMap="alertResult" parameterClass="int">
>       SELECT TOP 5 * 
>       FROM ods_exception_alert 
>       ORDER BY alert_time DESC
>   </select>
>  
> I know this is JDBC driver problem, but it would be great if iBATIS allowed doing text substitutions as a work-around. At the moment I guess I will have to rewrite SQL with sub selects. Is there another way to work-around this?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira