Run SQL statement

aaustriaco
Kilo Explorer

Hi, Is there a feature in ServiceNow where I can run a SQL statement on any table. The reason is I need to verify if the records I added/modified were correctly done in a table.
Thanks in advance for any response.

4 REPLIES 4

geoffcox
Giga Guru

The standard way of querying ServiceNow tables is with the GlideRecord object.

See http://wiki.servicenow.com/index.php?title=GlideRecord


Not applicable

Hi,

There is a different way which can be useful from time to time.

In QuickNav type in 'Background', and select 'Scripts — Background'. Some systems reserve this tool for users with the security-admin role.

In the 'Run script (JavaScript executed on server)' box, just type in:

gs.sql("");

would be any valid sql statement

Example:

gs.sql("select count(*) from ")


varunpune
Mega Contributor

This method is no longer allowed from Geneva version


varunpune
Mega Contributor

But you can install ODBC driver and run the sql from interactive sql which comes with the odbc package