
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
There are a number of posts on the Community Site that are referring to the use of an undocumented function called: gs.sql. This is an UNDOCUMENTED feature and should NOT be used under any circumstances. Most likely if ServiceNow does not document a function it is because it A) ServiceNow does not support its use B) can not offer support for it if it is used and C) ServiceNow does not want to encourage use of it.
As an example, I saw that one customer on the community was suggested to use the gs.sql function to truncate a database table. Truncating tables is an extremely DANGEROUS process.
Why the use of gs.sql is not supported by ServiceNow when truncating tables:
- If any record elsewhere in the database, references any record in the table that you are truncating, you will potentially "break" your instance.
- Could result in orphan ("ghost") records in the database, or potentially cause an outage!
Due to the way that ServiceNow relates tables, when using the recommended methods, we carry out a cascade delete, which removes records correctly.This is just one scenario where the use of this function should be avoided at all costs.
There are always ways of achieving your requirements within the product and information for how to carry these out are available in our product documentation.
To properly delete a custom table:
- Navigate to System Definition > Tables.
- Open the table to delete. [Recommended] Click Delete All Records.
- Click Delete.
- In the confirmation dialog box, enter delete and click OK.
The table and all items that reference the table will be removed.
To properly delete all records from a table:
- Navigate to System Definition > Tables and Columns.
- Select the table for which to delete records.
- Click Delete all records.
- In the confirmation dialog box, enter delete and click OK.
Make sure you are 100% positive you do not need the records from this table. Once completed, the table will still exist and any references to the table on other tables (such as business rules or reference fields) are preserved.but the records will be gone.
It may be tempting to use alternative unsupported methods to achieve what you want but there are always repercussions. ServiceNow Technical Support is always here to guide you through fixing your instance and to achieve your requirements, should there be any ambiguity or concerns.
Please Note: As of the Geneva Release; gs.sql has been deprecated.
- 10,416 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.