OK, let's dig deeper. Search the database for the lot number you are looking for. I'll post the script at the bottom of this message. I did not write this script, but I use it all of the time. It will tell you each table and column the exact lot number has been recorded in. Sometimes it's not the lot number, but some other random number. This will get you started on the trace. I think you need to determine how far the transaction progressed through posting and then fix it once we know. Put the value you are searching for where the words 'PUT YOUR VALUE HERE' appear. Your value needs to have a single quote on each side.
Leslie
DECLARE @table VARCHAR(64)
DECLARE @field VARCHAR(64)
DECLARE @string_value VARCHAR(64)
DECLARE @sql_script VARCHAR(1024)
SET @string_value = 'PUT YOUR VALUE HERE'
CREATE TABLE [tag:ResultsTable] (
TableName VARCHAR(64),
ColumnName VARCHAR(64)
)
DECLARE TABLES CURSOR
FOR
SELECT sysobjects.name, syscolumns.name
FROM syscolumns
INNER JOIN sysobjects ON syscolumns.id = sysobjects.id
WHERE sysobjects.type = 'U' AND syscolumns.xtype IN (167, 175, 231, 239)
ORDER BY sysobjects.name, syscolumns.name
OPEN TABLES
FETCH NEXT FROM TABLES
INTO @table, @field
WHILE @@FETCH_STATUS = 0
BEGIN
SET @sql_script = 'IF EXISTS(SELECT NULL FROM [' + @table + '] '
--SET @sql_script = @sql_script + 'WHERE RTRIM(LTRIM([' + @field + '])) = ''' + @string_value + ''') '
SET @sql_script = @sql_script + 'WHERE RTRIM(LTRIM([' + @field + '])) LIKE ''%' + @string_value + '%'') '
SET @sql_script = @sql_script + 'INSERT INTO [tag:ResultsTable] VALUES (''' + @table + ''', '''
SET @sql_script = @sql_script + @field + ''')'
EXEC(@sql_script)
FETCH NEXT FROM TABLES
INTO @table, @field
END
CLOSE TABLES
DEALLOCATE TABLES
SELECT *
FROM [tag:ResultsTable]
DROP TABLE [tag:ResultsTable]