I need to create a table variable with an identity seed that starts with the max value of a field in another table?
I\'ve tried this:
DECLARE @Identi
I believe you can do this, but it'll have to be done in dynamic SQL - declare the tableVar in the dynamic SQL and use it there too!
It would surely be easier and result in faster code if you started it at 1 and had a secondary ID field that is calculated as MAX(HHRecId) + ID.