I have a table with an IDENTITY column
[Id] int IDENTITY(1, 1) NOT NULL
After some lines are added / removed, I end the spaces in the Id values:
Id Name --------- 1 Tom 2 Bill 4 Kate
Is there an easy way to compress values to
Id Name --------- 1 Tom 2 Bill 3 Kate
?
I think it’s quite easy to create a second table with the same schema, import all the data (except for the identification column, of course, let the second table begin to renumber) from the first table, drop the first table and rename the Second name of the original.
There may be a problem if you have a ton of FK relationships to rebuild with other tables, etc.
I would strongly recommend leaving the values of identity as they are.
ID , .
- -, , ID_Display, ROW_NUMBER() . / , // , , , , FK PK.
ID_Display
, , , , , ""... . , , .
, , .
, , - ?
, .
, . IDENTITY ( ), :
IDENTITY
DELETE FROM db1.table SELECT col1, col2, col3 /* leave out the IDENTITY column */ INTO db1.table FROM db2.table
Source: https://habr.com/ru/post/1783465/More articles:How to make eclipse not auto-index code block - eclipsehow to find the reason for breaking the stack - chttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1783462/how-to-rewrite-python-dicts-to-get-default-values&usg=ALkJrhjXonU95oKpgE7PaAX5VWpR2p6KpgWhat are the object requirements (limitations) for storing an object in RavenDB - .netIs it possible to create an HTML 5 page from XML data? - javascriptHow to create a file system / directory manager in VC ++? - filesystemsHow to highlight a whole row of data in JTable? - javaFlex 4> spark.components.VideoPlayer> How do I switch the bit rate? - componentsЗаголовки MYSQL конфликтуют с STL в С++ - c++Wordpress custom Querystrings & Pretty URL - Как? - phpAll Articles