在SQL Server toad中运行查询时出错

时间:2017-10-04 14:33:28

标签: sql sql-server

任何人都可以帮助我解决在高级

中进入SQL Server Toad.Thanks的错误
select * from   
( 
SELECT  row_number() over ( order by (select null) ) rn, 
  Table1.column As RESPONSIBLE_ENTITY,
  ( with mycte as (
 SELECT  table2.objid, table2.title CONTRACT__TITLE
      FROM table2    
      WHERE
      (
      (table2.struct_type = 0) 

      )        
)
SELECT  Stuff(( SELECT ',' + cast(CONTRACT__TITLE as varchar(2000)) 
           FROM mycte t2
          WHERE t2.[objid] = t1.[objid]             
            FOR XML PATH(''), TYPE).value('.', 'varchar(max)'),1,1,'')  AS [AVILABLE_ENTITLEMENT]
  FROM mycte t1
GROUP BY t1.[objid]) AVILABLE_ENTITLEMENT,
   table3.Coulmn1       BILL_LINE_ITEM__NET_AMOUNT,
   table3.Coulmn2      BILL_LINE_ITEM__BILL_TOTAL

 from table3 
          ) dt where rn between 0 and 100 

错误:-SQL Server数据库错误:关键字'with'附近的语法不正确。

0 个答案:

没有答案