{"id":1267,"date":"2015-10-22T09:35:47","date_gmt":"2015-10-22T12:35:47","guid":{"rendered":"http:\/\/www.franklinjr.com\/blog\/?p=1267"},"modified":"2015-10-22T09:35:47","modified_gmt":"2015-10-22T12:35:47","slug":"sql-server-pulando-campo-com-id-auto-increment","status":"publish","type":"post","link":"https:\/\/www.franklinjr.com\/blog\/index.php\/2015\/10\/22\/sql-server-pulando-campo-com-id-auto-increment\/","title":{"rendered":"SQL Server pulando campo com id auto increment"},"content":{"rendered":"<p>Isso acontece a partir da vers\u00e3o 2012 do sql server. Quando tu tem uma tabela com campo id auto increment, e o servi\u00e7o do sql server \u00e9 parado de forma abrupta, ap\u00f3s a inicializa\u00e7\u00e3o do servi\u00e7o, a pr\u00f3xima inser\u00e7\u00e3o na tabela ter\u00e1 um acr\u00e9scimo de 1000, para o tipo int, ou 10000, para o tipo bigint no campo id.<\/p>\n<p><a href=\"http:\/\/www.franklinjr.com\/blog\/wp-content\/uploads\/2015\/10\/FullTable.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1272 aligncenter\" src=\"http:\/\/www.franklinjr.com\/blog\/wp-content\/uploads\/2015\/10\/FullTable.png\" alt=\"FullTable\" width=\"161\" height=\"142\" \/><\/a><\/p>\n<p>Na internet encontrei alguns links para o contorno desse problema, um deles \u00e9 criar uma sequ\u00eancia, conforme descrito no link\u00a0<a href=\"http:\/\/www.codeproject.com\/Tips\/668042\/SQL-Server-Auto-Identity-Column-Value-Jump-Is\" target=\"_blank\">http:\/\/www.codeproject.com\/Tips\/668042\/SQL-Server-Auto-Identity-Column-Value-Jump-Is<\/a>, e a outra \u00e9 adicionar o parametro -t272, na inicializa\u00e7\u00e3o do sql server.<\/p>\n<p><a href=\"http:\/\/www.franklinjr.com\/blog\/wp-content\/uploads\/2015\/10\/StartupParameter.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1271 \" src=\"http:\/\/www.franklinjr.com\/blog\/wp-content\/uploads\/2015\/10\/StartupParameter.png\" alt=\"StartupParameter\" width=\"520\" height=\"464\" srcset=\"https:\/\/www.franklinjr.com\/blog\/wp-content\/uploads\/2015\/10\/StartupParameter.png 695w, https:\/\/www.franklinjr.com\/blog\/wp-content\/uploads\/2015\/10\/StartupParameter-300x268.png 300w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/a><\/p>\n<p>Pesquisando vi que esse par\u00e2metro n\u00e3o \u00e9 oficialmente documentado pela Microsoft, e ele parece modificar a engine do sql server. Vi que muita gente fez isso para sanar o problema e n\u00e3o teve problemas com essa configura\u00e7\u00e3o, mas n\u00e3o h\u00e1 nenhuma documenta\u00e7\u00e3o oficial a respeito disso.<\/p>\n<p>Refer\u00eancia:<br \/>\n<a href=\"http:\/\/www.codeproject.com\/Tips\/668042\/SQL-Server-Auto-Identity-Column-Value-Jump-Is\" target=\"_blank\">http:\/\/www.codeproject.com\/Tips\/668042\/SQL-Server-Auto-Identity-Column-Value-Jump-Is<\/a><br \/>\n<a href=\"http:\/\/dba.stackexchange.com\/questions\/88930\/identity-value-jumps-when-restarting-sql-server\" target=\"_blank\">http:\/\/dba.stackexchange.com\/questions\/88930\/identity-value-jumps-when-restarting-sql-server<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Isso acontece a partir da vers\u00e3o 2012 do sql server. Quando tu tem uma tabela com campo id auto increment, e o servi\u00e7o do sql server \u00e9 parado de forma abrupta, ap\u00f3s a inicializa\u00e7\u00e3o do servi\u00e7o, a pr\u00f3xima inser\u00e7\u00e3o na tabela ter\u00e1 um acr\u00e9scimo de 1000, para o tipo int, ou 10000, para o tipo [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[506,441,51],"tags":[475,430,547],"class_list":["post-1267","post","type-post","status-publish","format-standard","hentry","category-sql-2","category-sql-server-2","category-windows","tag-mssql","tag-sql-server","tag-sqlserver2012"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>SQL Server pulando campo com id auto increment - Franklin Jr.<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.franklinjr.com\/blog\/index.php\/2015\/10\/22\/sql-server-pulando-campo-com-id-auto-increment\/\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.franklinjr.com\\\/blog\\\/index.php\\\/2015\\\/10\\\/22\\\/sql-server-pulando-campo-com-id-auto-increment\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\\\/\\\/www.franklinjr.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server pulando campo com id auto increment\"}]}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Server pulando campo com id auto increment - Franklin Jr.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.franklinjr.com\/blog\/index.php\/2015\/10\/22\/sql-server-pulando-campo-com-id-auto-increment\/","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/www.franklinjr.com\/blog\/index.php\/2015\/10\/22\/sql-server-pulando-campo-com-id-auto-increment\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/www.franklinjr.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server pulando campo com id auto increment"}]}]}},"_links":{"self":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1267"}],"version-history":[{"count":4,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1267\/revisions"}],"predecessor-version":[{"id":1274,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1267\/revisions\/1274"}],"wp:attachment":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}