How to Search all Columns in All Tables for a Specific GUID

Version 6

    Verified Product Versions

    LANDESK Service Desk 7.8.xLANDESK Service Desk 2016.xLANDESK Asset Central 2016.x

    When a person has the guid for a specific business object instance, they often want to know where this object is related. This would require running a query for this information against the entire Service Desk database. There is no built in executable or stored procedure that accomplishes this. However, Narayana Vyas Kondreddi, a brilliant SQL developer, created an efficient stored procedure named "SearchAllTables" to accomplish this task. The original content of this stored procedure can be found at http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm.

     

    This stored procedure has been slightly modified so that it will include the "uniqueidentifier" data type that is used in all of the Service Desk guids.  The modified version is attached herewith.

     

    In order to make this work, the query syntax must first be run on the Service Desk database. This will create a stored procedure named "SearchAllTables." Then the user will execute the stored procedure by using the following syntax:

     

    EXEC SearchAllTables '{object guid}'

     

    This will scour all the tables in the Service Desk database for any instance of the guid. This can assist in showing you the relationships of this business object to other objects, and also assist in understanding the database structure.