{"id":490,"date":"2011-09-06T20:00:38","date_gmt":"2011-09-06T15:00:38","guid":{"rendered":"http:\/\/www.esearing.com\/v2010\/?p=490"},"modified":"2011-09-06T20:00:38","modified_gmt":"2011-09-06T15:00:38","slug":"sql-numbering-a-table-in-sequence-without-identity","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2011\/09\/sql-numbering-a-table-in-sequence-without-identity\/","title":{"rendered":"SQL Numbering a table in sequence without IDENTITY"},"content":{"rendered":"<p>This is for renumbering of the rows in a table with out IDENTITY.  <\/p>\n<p><code>-- add a rowid to the table<br \/>\nALTER TABLE #table_name<br \/>\nADD rowid int null<br \/>\n-- set the rowid vales to zero<br \/>\nUPDATE #table_name<br \/>\nSET rowid = 0<br \/>\n-- declare a variable to increase<br \/>\nDECLARE @rowid int<br \/>\nSET @rowid = 0<br \/>\n-- update the table<br \/>\nUPDATE #table_name<br \/>\nSET @rowid = rowid = @rowid + 1<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is for renumbering of the rows in a table with out IDENTITY. &#8212; add a rowid to the table ALTER TABLE #table_name ADD rowid int null &#8212; set the rowid vales to zero UPDATE #table_name SET rowid = 0 &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2011\/09\/sql-numbering-a-table-in-sequence-without-identity\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,24,14],"tags":[],"class_list":["post-490","post","type-post","status-publish","format-standard","hentry","category-code","category-snippets-quick-code-tips-for-single-elements-attributes-or-details","category-sql"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/comments?post=490"}],"version-history":[{"count":3,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/490\/revisions"}],"predecessor-version":[{"id":493,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/490\/revisions\/493"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}