#1414: MSSQL error when using limit and order by
-----------------------------------+----------------------------------------
 Reporter:  purnama                |       Owner:  jwage
     Type:  defect                 |      Status:  new  
 Priority:  minor                  |   Milestone:  New  
Component:  Connection             |     Version:  0.11 
 Keywords:  MSSQL TSQL LIMIT TOP   |    Has_test:  0    
 Mystatus:  Pending Core Response  |   Has_patch:  0    
-----------------------------------+----------------------------------------
 i'm trying to execute a TSQL query with doctrine pager (using dql of
 course)

 Doctrine_Query::getSql =
 {{{
 SELECT
   [d].[ext] AS [d__ext], [d].[name] AS [d__name], [d].[postn] AS
 [d__postn],
   [d].[subdept] AS [d__subdept], [d].[dept] AS [d__dept]
 FROM
   [dbo].[organization] [d]
 ORDER BY
   [d].[name] asc
 }}}

 snapshot query before executed by Doctrine_Pager =
 {{{
 SELECT * FROM (
   SELECT TOP 20 * FROM (
     SELECT TOP 60
       [d].[ext] AS [d__ext],
       [d].[name] AS [d__name],
       [d].[postn] AS [d__postn],
       [d].[subdept] AS [d__subdept],
       [d].[dept] AS [d__dept]
     FROM [dbo].[organization] [d]
     ORDER BY [d].[name] asc
   ) AS inner_tbl
   ORDER BY [d].[name] DESC
 ) AS outer_tbl ORDER BY [d].[name] asc
 }}}

 exception :

 SQLSTATE[HY000]: General error: 20018 The column prefix 'd' does not match
 with a table name or alias name used in the query. [20018] (severity 5)

 seems error caused by table alias not properly updated by
 Doctrine_Connection_Mssql::modifyLimitQuery.

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1414>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to