;with ta as(select * from a)这么简单的语句!
总是提示“)”附近有语法错误,无语啊,求高手指教

解决方案 »

  1.   


    ;with ta as(select * from a)
    SELECT * FROM ta--使用CTE
      

  2.   

    ;with ta as(select * from a)
    select * from ta
    --with表达式写完你需要调用它。
      

  3.   

    后面 select * from cte
     - -!
      

  4.   


    如果我想在if语句中使用CET该怎么做呢?
    if exists(select * from ta)如果我想这样用,该怎么写呢?
      

  5.   

    因为select * 没有明确声明列名,请用明确的列名select col1,col2... from a
      

  6.   

    select * from ta --这个必须有
      

  7.   

    select * from ta  --这个必须有
      

  8.   

    CTE一旦创建,后面必须紧跟使用该CTE的语句。
      

  9.   


    ;with ta as(select * from a)
    if exists (select * from ta)  --使用完后ta失效!
    begin
    ...
    end
    else
    begin
    ...
    end
    go