FETCH NEXT FROM modelid1 INTO @query, @queryIDIndex
WHILE @@FETCH_STATUS = 0
BEGIN
BEGIN TRAN tran1
EXEC (@query)
IF @@ERROR <> 0
UPDATE md_querys_queue
SET completed = 0
WHERE queryid = @queryIDIndex
AND location = @LOCATION
ELSE
UPDATE md_querys_queue
SET completed = 1
WHERE queryid = @queryIDIndex
AND location = @LOCATION
COMMIT TRAN tran1
FETCH NEXT FROM modelid1 INTO @query, @queryIDIndex
END
|