• One of the reason you don't have much of answers is that your posted code cannot be executed without error...

    INSERT INTO FreightContents VALUES('FJ#1000210','104001-00-3')

    ...

    results with error:

    Msg 213, Level 16, State 1, Line 1

    Column name or number of supplied values does not match table definition.

    So, which columns the above data should be inserted into?

    Also, runnable query with CTE would help more than just some cut out of it.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]