DECLARE @TABLENAME UD_DESCRIPCION
DECLARE @TYPE CHAR(1)
DECLARE @CADENA VARCHAR(100)
DECLARE TABLAS CURSOR FOR SELECT TABLENAME,TYPE FROM SH_SHIPPINGTABLES where type <>'X' order by sequence desc

OPEN TABLAS

FETCH NEXT FROM TABLAS INTO  @TABLENAME,@TYPE 
WHILE @@FETCH_STATUS = 0
BEGIN
	SET @CADENA= 'delete  '+@TABLENAME

	IF(	@TABLENAME='SITES' OR @TABLENAME='SETUP' OR @TABLENAME='SH_SHIPPINGTABLES' OR 
		@TABLENAME='SE_USERREC' OR @TABLENAME='SE_ACCESSDETRIGHTS') 

		SELECT 'TABLA DE SISTEMA'
	ELSE
		BEGIN
			SELECT @TABLENAME
			EXEC (@CADENA)
	END
	FETCH NEXT FROM TABLAS INTO  @TABLENAME,@TYPE 
END

CLOSE TABLAS
DEALLOCATE TABLAS

go
SELECT * FROM SE_USERREC
SELECT * FROM SE_ACCESSDETRIGHTS