6 Replies Latest reply on Nov 10, 2018 12:02 AM by Yun Feng

    Custom sql parameter setting problem

    Yun Feng

      Hi

       

      I have many tables in one database, all of them look like:

      Table N:

      标题 1标题 2标题 3
      DATENTEMP_N
      2018010112

      For example, Table TEST:

      标题 1标题 2标题 3
      DATETESTTEMP_TEST
      2018010346

      I have created a parameter TABLE_NAME which can select N from a string list.

      The problem is when I write sql: select DATE, TABLE_NAME as COLUMN1, 'TEMP_' + TABLE_NAME as COLUMN2 from TABLE_NAME. The result is wrong, cause TABLE_NAME is a string.

      So I change the sql to: select A.DATE, A.TABLE_NAME as COLUMN1, A.'TEMP_' + TABLE_NAME as COLUMN2 from TABLE_NAME A.But the sql A.'TEMP_' + TABLE_NAME as COLUMN2 is wrong.

      I also tried to set another parameter to represent 'TEMP_' + TABLE_NAME, but seems can't write parameter like this.

      I don't know how to fix this, can anyone know how to fix it?

       

      Thank you!