How do I use SQL to query ServiceNow?

ivanr
Tera Contributor

Is there a place I can write SQL in ServiceNow to query the tables? You would think there would at least be a command line interface to my MySQL backend right?

3 REPLIES 3

Deepak Kumar5
Kilo Sage

It is restricted in New version to run it from UI. Before you could use Background script to run it.



gs.sql("select * from incident;");


drjohnchun
Tera Guru

You used to be able to use gs.sql() to run MySQL queries in Background Script, but it's no longer available since the Geneva release.



Another option is to use ODBC connection and run SQL queries; although you can do a lot with it, this SQL is not the same as the MySQL dialect.



I ran a blog series on creating what I called Glide Query Language (GQL) that mimics SQL using GlideRecord.



Hope this helps.



Please feel free to connect, follow, mark helpful / answer, like, endorse.


John Chun, PhD PMP see John's LinkedIn profile

visit snowaid


ServiceNow Advocate

unable to access above links