**WARNING: This is not kids stuff. Use of this feature requires expertise in SQL Server and in the Cyrious database structure. It is very possible to irreversibly damage your Cyrious Control database if you make a mistake. Always develop your tests using a separate database on a separate machine. If you are interested in using sql_bridge but are not a SQL guru, please contact a sales or consulting at Cyrious.**

Overview

This script will unlock all locked records in the Recomputer Monitor. This should only be used as a part of troubleshooting locked records and should not be part of a typical production routine.

The script requires sql_bridge in order to obtain IDs for the inserted records. sql_bridge is a collection of SQL Server stored prodedures and functions and external modules that can be called to safely insert or update data into the Control database and notify the CHAPI service that data has been updated. The CHAPI service is a controller program that will then notify the SSLIP and all copies of Control about the changes.

Example Usage

-- SQL Procedure to Clear Locks on Orders in Recompute Monitor -- 
---------------------------------------------
DECLARE @Recs TABLE (ID INT, CLASSTYPEID INT);
DECLARE @ID INT, @ClassTypeID INT;
 
INSERT INTO @Recs
  SELECT ID, ClassTypeID FROM RecomputeMonitor;
 
DECLARE LockedRecord CURSOR FOR 
  SELECT ID, CLASSTYPEID FROM @Recs;
 
OPEN LockedRecord;
FETCH NEXT FROM LockedRecord INTO @ID, @ClassTypeID;
 
WHILE @@FETCH_STATUS = 0
BEGIN
  SELECT dbo.csf_chapi_unlock(@ID, @ClassTypeID)
  FETCH NEXT FROM LockedRecord INTO @ID, @ClassTypeID;
END
 
CLOSE LockedRecord;
DEALLOCATE LockedRecord;

Contributor: Cyrious Software

Date: 1/2017

Version: Control 5.7+

You could leave a comment if you were logged in.