incorrect syntax near ')' RRS feed

  • Question

  • I tried to run a query in SQL server like this:

    select * into table from (select......) a

    I found that this query cannot be run without the "a" at the end.

    Without the "a", error "incorrect syntax near ')'" would be shown.

    What does the "a" mean and what does it do??

    Please kindly advise.

    Thank you!!

    Wednesday, September 17, 2014 3:04 AM


  • You need to put 'a' as the name of the sub-query table, which is

    (select ...)
    'a' does serve as the synonym name of the sub-query table.

    Many Thanks & Best Regards, Hua Min

    Wednesday, September 17, 2014 3:17 AM