• Yes, your code appears to assume that the row that was inserted is the one with the maximum PAT_ACCOUNT_MANAGER_ID. Even if that column had an identity property, that would be a dangerous assumption to make, but since it doesn't, your trigger is even more likely to fail. Worse than that, it could do something unexpected but not return an error at all. I assume you're relying on your application to generate the next number in the sequence?

    Gail is right - you need to use the Inserted virtual table to get the value(s) you're looking for. The "(s)" is important, because sometimes more than one row might be inserted in a single transaction.

    John