Hi Hemant,


It seems likely your user cannot read the sys_choice table.


ISQL is another issue.



Check this out to fix   the "your user cannot read the sys_choice table" issue.


Getting Started with ODBC - ServiceNow Wiki


4.1 Set User Permissions

Since the ODBC driver communicates with the instance using SOAP, the user account must have the soap_query role. The soap role also provides query access through SOAP, but allows additional actions that are not available through ODBC, such as insert or update.


The user account must also be able to read records on the tables you want to query. For example, to query incident records, the ODBC user must have read permission for the Incident table. You can create a new role, for example a role called ODBC, grant that role to the ODBC user, and configure ACL rules to allow users with that role to query the Incident table.


To create the ODBC role and grant the ODBC user the required roles:


  1. Navigate to User Administration > Roles.
  2. Click New.
  3. In the Name field, enter ODBC.
  4. Click Submit.
  5. Navigate to User Administration > Users.
  6. Select the ODBC user account you created.
  7. In the Roles related list, click Edit.
  8. Use the slushbucket to add the ODBC and soap_query roles.

To define ACL rules for the ODBC role:


  1. Elevate the session permissions so you can create ACL rules.
  2. Navigate to System Security > Access Controls (ACL).
  3. Click New.
  4. From the Operation choice list, select read.
  5. From the Name choice list, select Incident [incident].
    Leave the second Name choice list as None.
  6. Right-click the form header and select Save.
  7. In the Requires role related list, click Edit.
  8. Use the slushbucket to add the ODBC role.


Best Regards



Tony


Hi Tony,


I did follow all the steps defined above.



Here is the query I am using:





select * from OPENQUERY(SERVICENOW,'select [label],element,dependent_value,[hint],language,cast(sequence as int),sys_id,value from sys_choice order by [label] asc')



I am getting correct data for only 'label' column. All other columns show up as NULL, though they have data in them.




Hi Tony,


I created a ACL on column 'element' and I was able to pull data for that column. Will try to create ACLs for other columns as well and see if it works. But not sure why I have to create at column level when I already have one at table level.




Thanks,


Hemant


Hi Hemant,


Good news!



You can OK all the fields at the same time with a sys_choice.*



Best Regards



Tony


View solution in original post

Thanks Tony. sys_choice.* works well..



Cheers!