Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL add a row to a table with and identity field that is not the next identifier

$
0
0

Hello everyone.

I wrote a program that will give out the next incremental number in a column in an sql database. The database handles the identity field and I am trying to find a way to add a row that is not the next one in the sequence.We imported data from a spreadsheet that was supposed to be incremental. We discovered that we were missing a few that people never put in the spreadsheet. see the example below because I am terrible at explaining this.

Col1(identity)col2col3

1
2
4
5

I need to add a row that in col1 is 3 but when I try to add a row 6 will auto populate and is not editable.

Any ideas or suggestions would be great. The only thing I can think of is to turn identity off then add the row turn it back on and re seed at the next number. This would work but would be worrisome in my production database.


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>