Using ServiceNow iSQL

Note: iSQL was discontinued in ServiceNow.  It was fun to hack ServiceNow with it, but no longer! Still, I'll keep this article published for history's sake.

ServiceNow has a iSQL tool available, where you can make iSQL commands using the ODBC driver. iSQL is helpful to troubleshoot issues and make queries, especially if you are familiar with SQL commands.  Here is quick guide to the usage of iSQL:

Step 1: Install the ServiceNow ODBC Driver.

I always choose the 32-bit version as I have less issues with that version regardless of my OS version.  However ServiceNow has a 64-bit version available as well.  Download the ODBC driver and install according the instructions on the ServiceNow Wiki.

Step 2: Connect to ServiceNow

1. Go to Start > All Programs > ServiceNow ODBC > ODBC Administrator

 ServiceNow ODBC Data Source Administrator

2. Click the System DSN tab and configure the ServiceNow data source.

  ServiceNow ODBC Data Source Administrator

3.  In the Custom Properties field, add your instance


4. Click Test Connect and Apply

Step 3: Run iSQL Queries

1. Go to Start > All Programs > ServiceNow ODBC > Interactive SQL (ODBC)
2. Connect to serviceNow.  Replace username and password with yours: 
CONNECT username*password@ServiceNow
3. Turn QuickEdit Mode on by right clicking the window and selecting properties > Options > QuickEdit Mode: true
This helps a lot that you can paste text by right clicking the window, and copy text by CTRL-C. 
4. Start executing your queries!

Example queries:

  • select number, dv_caller_id, caller_id from incident;
  • select count(*), dv_caller_id from incident where dv_caller_id is not null group by dv_caller_id;
  • SELECT number, short_description from incident;
  • select name, sys_id from sys_user where user_name = 'admin';
  • select * from incident where number='INC00100010';
  • select name, version from cmdb_ci_spkg where name = 'Adobe Acrobat';
  • select b.number AS [Incident_Number], AS [CI_Name], b.short_description AS [Incident_Short_Description] from cmdb_ci a, incident b where a.sys_id=b.cmdb_ci AND = 'Client Services';

 ServiceNow Interactive SQL