Delete supernumerary MQCP tables on MS SQL

Document ID : KB000088164
Last Modified Date : 14/04/2018
Show Technical Document Details
Issue:
With the following command you can delete MQCP-tables. E.g., if you want to delete tables MQCP006 to MQCP009, the command looks like this:
 
DECLARE @tableName varchar(50), @dsql nvarchar(95)
DECLARE cur CURSOR FOR 
SELECT name FROM sys.Tables
WHERE name in ('MQCP006', 'MQCP007', 'MQCP008', 'MQCP009')
OPEN cur
FETCH NEXT FROM cur
INTO @tableName
 
WHILE (@@FETCH_STATUS = 0)
BEGIN
SET @dsql = 'DROP TABLE ' + @tableName
EXEC sp_executesql @dsql
FETCH NEXT FROM cur INTO @tableName
END
CLOSE cur
DEALLOCATE cur
GO
 
In the third line, in the select, the MQCP-tables to be deleted have to be entered.
 
With the command below you can check which tables are available:
 
SELECT name FROM sys.Tables WHERE name LIKE 'MQCP%'
Resolution:
This field was added on 30/03/2017. This article has not been updated yet. Refer to the "Description" or "Workaround" sections for solution information.