9 Replies Latest reply: May 16, 2014 7:07 AM by Laura Sébille RSS

    String variables in script

      Hello everyone,


      I extract data from 5 databases which have excatly the same structure (same tables, same name of columns). Each database contains the data for one city.


      I want to use all these data in one only table. The problem is that, I have in each table, idCustomer=1 whereas it doesn't stand for the same customer...


      So what I've done so far is that I've created a new column 'City' when I import the data and then I concatenate the first letter of the city in front of every ID. So I have for example, P01, L01 and so on...


      These is a piece of code :




      'Paris' AS Ville,

      'P'&id AS id_client

      FROM TableCity


      And I do this for each city...


      It has worked so far but the thing is that in the future, there will be more cities... and besides,  I dont like the fact that I have to write the 'P' in front of the names of each columns..


      I would like to use a variable that contains the 'P' and something like this :


      LET vVille='P';



      $(vVille) & id as idClient;


      SQL SELECT * FROM TableCity


      But it doesn't work because the string variable doesnt "remember" the ' ' in the LOAD...



      Have you got an idea of how I could do this ?


      Or if you have a more consistent solution to solve my problem, i would also glad to read it !



      Thank you very much and have a good day !