Update column with sequential numbers

2,152 views
Skip to first unread message

Chris Buchanan

unread,
Sep 10, 2009, 2:00:51 PM9/10/09
to MapInfo-L
I have a field that I would like to update with sequential series,
starting at 1. Is there an easy way to do this in MapInfo. I've been
trying for an hour or so now and it is defeating me.

Thanks for you help.

Chris

Will Mitchell

unread,
Sep 10, 2009, 2:02:38 PM9/10/09
to mapi...@googlegroups.com
Hi Chris,

You can do this with an Update Column statement using 'ROWID' as the value

Will Mitchell
Mitchell Geographics, Inc.
188 State Street, Suite 200
Portland, ME 04101
Office: 207.879.7769
Mobile: 207.650.2057
Fax: 207.221.5861
www.mitchellgeo.com

Steve Smith

unread,
Sep 10, 2009, 5:54:00 PM9/10/09
to mapi...@googlegroups.com

Update TabName Set ColName = RowID

or something like


Regards

Steve Smith
Australian Bureau of Statistics (ABS)
Post: Locked Bag 10 Belconnen ACT 2616
Location: ABS House, 45 Benjamin Way, Belconnen ACT 2617
Geography / Spatial Data Management and Research
ABS Level 2 South 232 , Wk: (02) 6252-6824
wk email: steve...@abs.gov.au


Inactive hide details for Chris Buchanan ---11/09/2009 04:12:39 AM---I have a field that I would like to update with sequentialChris Buchanan ---11/09/2009 04:12:39 AM---I have a field that I would like to update with sequential series, starting at 1. Is there an easy


From:

Chris Buchanan <a07...@mun.ca>

To:

MapInfo-L <mapi...@googlegroups.com>

Date:

11/09/2009 04:12 AM

Subject:


[MI-L] Update column with sequential numbers

------------------------------------------------------------------------------------------------

Free publications and statistics available on www.abs.gov.au

 

Mats Elfström

unread,
Sep 11, 2009, 4:19:38 AM9/11/09
to mapi...@googlegroups.com
Hi Chris!
 
RowId is the obvious suggestion, but you will get no control over the sort order.
Understand that it's the current, more or less arbitrary table order that is exposed with RowId.
If you need a particular sort order, and not just a unique number you will need to sort and save the table before.
Sorting has recently been discussed on this list. 
2009/9/10 Will Mitchell <wi...@mitchellgeo.com>

Spencer Simpson

unread,
Sep 11, 2009, 10:14:09 AM9/11/09
to mapi...@googlegroups.com

You should be able to sort the table and update a column with RowID, and the number sequence will reflect the sorted order......

 

Select * from mytab into sorted_tab order by whatever,columns,you,like

Update sorted_Tab set seqID=rowid

Close table sorted_tab

Select * from mytab into sorted_tab order by SeqID  ' should be in the same order as before

 

It's certainly worked for me. No need to save the sorted table.

HTH


Spencer


<br

Reply all
Reply to author
Forward
0 new messages