7 Replies Latest reply: Mar 28, 2012 10:44 AM by kgsmith5 RSS

ODBC Connection

kgsmith5

I have a Qlikview application that uses and ODBC connection to get data from a database table. I am trying to set an alias for two fields, so that the fields will appear as lowercase values. This is not working for me and I am not sure how to force the alias for the field name to be loaded as lower case.

 

SELECT


N.ACCOUNT_ID,
N.NAME_ID,
AD.ZIP_CODE,
Z.LATITUDE as latitude,
Z.LONGITUDE as longitude,
Z.DMA,
Z.STATE,
Z.STATION_SUPPORT

FROM

NAMES N,

ADDRESSES AD,

ZIP_CODE Z

 

WHERE N.ACCOUNT_ID = AD.ACCOUNT_ID

and N.PREFERRED_ADDRESS_ID = AD.ADDRESS_ID

AND AD.ZIP_CODE = Z.ZIP_CODE

When you go to the expression builder, the field names appear in all upper case, but I need them to be in lower case as the alias in the script.

Can anyone help???

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • ODBC Connection
    Marc Livingston

    have you tried using a preceding Load to see how it affects it?

    • Re: ODBC Connection
      kgsmith5

      I am new to Qlikview, so not familiar with all the functionality. Can you give me an example?

      • ODBC Connection
        Marc Livingston

        I believe it would look something like this for you. you just do all the name changing and any other changes here.

         

        Load

        N.ACCOUNT_ID as 'Account ID',
        N.NAME_ID as 'Name ID',
        AD.ZIP_CODE as 'Zip Code',
        Z.LATITUDE as Latitude,
        Z.LONGITUDE  as Longitude,
        Z.DMA as DMA,
        Z.STATE as State,
        Z.STATION_SUPPORT as 'Station Support';

        SELECT

  • ODBC Connection
    Josh Duenyas

    There is actually no need for the Load statement.

    Simply alias each field to the way you want it to be like such:

     

    N.ACCOUNT_ID AS Account_ID,

    N.NAME_ID AS Name_ID,

    AD.ZIP_CODE AS Zip_Code,

    Z.LATITUDE as latitude,

    Z.LONGITUDE as longitude,

    Z.DMA AS dma,

    Z.STATE As State,

    Z.STATION_SUPPORT As Station_Support

     

    Etc.

     

    • Re: ODBC Connection
      kgsmith5

      I have aliased the field, however after the data is loaded it does not keep the mixed case, the field names all display as upper case.

      • ODBC Connection
        kgsmith5

        The correct answer is to put an alias before the select statement:

         

        ALIAS LONGITUDE as longitude, LATITUDE as latitude;

         

        This resolved the issue.

      • Re: ODBC Connection
        kgsmith5

        I found the answer: add the following statement prior to the sql select statement.

         

        ALIAS LONGITUDE as longitude, LATITUDE as latitude;

        SELECT

        N.ACCOUNT_ID,

        N.NAME_ID,

        AD.ZIP_CODE,

        Z.LATITUDE,

        Z.LONGITUDE

        FROM ....

        This worked.