0 Replies Latest reply: Jan 15, 2012 6:44 AM by Ori Tal RSS

    Priority ERP : Select Tables Keys From SQL Server

      Hi, Im using Incremental load to update QlikView from Priority ERP connected to SQL Server DB.

      A part of the script requires the table key

      I would like to build an automated program that will select all tables keys

      in order to use it in my incremental load script

      I have found an SQL that suppose to do the job but I get only a few tables and they aren't Priority tables


      SQL SELECT 

          i.name AS IndexName,        

          OBJECT_NAME(ic.OBJECT_ID) AS TableName,        

          COL_NAME(ic.OBJECT_ID,ic.column_id) AS ColumnName

      FROM    sys.indexes AS i INNER JOIN   sys.index_columns AS ic ON  i.OBJECT_ID = ic.OBJECT_ID AND i.index_id = ic.index_id

      WHERE   i.is_primary_key = 1;

       

       

      Can someone please tell me what am I doing wrong?


      Thanks for your help


      Ori