0

I create a table variable with an identity column in my script, I want to reseed this column. Can I use below script?

DBCC CHECKIDENT (tableVariableName, reseed, @NewStartSeedValue)
Charles
  • 50,943
  • 13
  • 104
  • 142
masoud ramezani
  • 22,228
  • 29
  • 98
  • 151

1 Answers1

1

You cannot reseed a table variable's identity column, you would need to use a temp table instead. Depending on what you want to do, the ranking functions (row_number()) may be of use.

Alex K.
  • 171,639
  • 30
  • 264
  • 288