SQL for adding flags depending on criteria

  • Client tool is irrelevant, we need to know what version of the database engine you are using to suggest code that has a hope in hell of doing what you want.

    Since WITH throws an error, I doubt it's SQL Server 2012 (which we assumed based on the forum this is posted in)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Sorry, its Adaptive server enterprise version 15

    Am I on the wrong forum? Can you point me in the right direction?

    Thanks

  • Yes, you are on the wrong forum. ASE is a Sybase product. I imagine there is a forum somewhere for ASE T-SQL.

    I think your problem is that the T-SQL in ASE doesn't support CTEs (oddly enough, though, SQL Anywhere does support them - so if you can switch to SQL Anwhere you should be OK).

    Sybases documentation says

    Migrating SQL Anywhere database applications to ASE


    SQL Anywhere supports common table expressions, the inlined declaration of views within a query expression using the WITH clause. In ASE, you must instead explicitly create a permanent view. Common table expressions are SQL/2008 language feature T121.

    Maybe you could use a subquery (implicit view expresion) instead of an explicit CTE - I don't know Sybase T-SQL well enough to be much help in such a rewrite.

    Tom

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply