Subscribe: Comments on My SysAd Blog -- Unix: Assign Unique Numbers to Columns in Database - Ora...
http://www.mysysad.com/feeds/1147837292433963991/comments/default
Added By: Feedage Forager Feedage Grade C rated
Language: English
Tags:
counter update  counter  index  issue mysql  issue  mysql  ran similar  ran  set counter  set  similar issue  similar  update mytable 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Comments on My SysAd Blog -- Unix: Assign Unique Numbers to Columns in Database - Ora...

Comments on My SysAd Blog -- Unix: Assign Unique Numbers to Columns in Database - Oracle





Updated: 2017-08-10T07:44:05.379-07:00

 



I ran into a very similar issue in MySQL the other...

2007-12-26T17:24:00.000-08:00

I ran into a very similar issue in MySQL the other day. The MySQL equivalent is:

SET @counter = -1;
UPDATE MyTable SET MyColumn=(@counter:=(@counter+1))

Note that you initialize @counter to -1 so that it ends up at zero for the first record, because the := operator returns the assigned value. If you want to 1 index instead of zero index, start @counter at 0.