How do I use SQL to query ServiceNow?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 08:09 PM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 08:46 PM
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;");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 08:49 PM
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 ![]() | ![]() |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2022 03:38 AM
unable to access above links