The query looks fine to me. The only thing I can think of is somehow the cursor is messing up. I would have a step in your DTS package that selects the records into a table so you can monitor this. Also, try getting rid of the cursor. You shouldn't really use it anyway. :)CREATE PROCEDURE [dbo].[pmCode_compile_all_items_mfgpro] ASDECLARE @itemVar CHAR(5), @min INT, @max INTDELETE tbl_crossPlant_PMCodes_Compiled--for drawingsDECLARE @items TABLE( ident INT IDENTITY(1,1) PRIMARY KEY, item VARCHAR(5))INSERT @items(item) SELECT DISTINCT (LEFT(item,5)) AS item FROM [ana no dups] WHERE item LIKE '[0-2][0-9][0-9][0-9][0-9]-%' AND (status <> 'obsolete' AND status <> 'phaseout')SELECT @min = 1, @max = (SELECT MAX(ident) FROM @items)WHILE @min <= @maxBEGIN SELECT @itemVar = (SELECT item FROM @items WHERE ident = @min) EXEC pmCode_compile_per_item @item = @itemVar, @itemType = 'D'SELECT @min = @min + 1END
MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA.