An alternative that I use to maintain the uniqueness of a column is to use a
generic function that looks something like this:

Function GetNextId(ByVal Tab_name as string,Col_name as string) as integer
        dim cmd as string
        Dim i as integer
        cmd = "select max("+col_name+") from "+tab_name into maxval
        i = maxval.col1 + 1
        close table maxval
        GetNextId = i
End Function

I sometimes also include the a statement to index the column - just in case
it has been removed.

Cheers

Martin
==================================
Martin Roundill
GIS Manager
Waitakere City Council
Private Bag 93109
Henderson
Waitakere City
New Zealand


-----Original Message-----
From: Trey Pattillo [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 January 2000 14:33
To: MapInfo List; Fran Peck
Subject: Re: MI Id question thanks


Hi all,

Just a note to Fran's using the RowID as an "identifier"

>Thanks to all who responded to my MI ID question. The solution of creating
>an ID column and updating column with ROWID was perfect. Got that project
>done in short order!  I really appreciate the help.

DON'T EVER PACK THE TABLE.............ESPECIALLY IF YOU HAVE DELETES.

1) initially 100 records
2) id's = 1...100
3) delete every 10th record 1..9, 11..19, 20..29
4) pack the table
5) now there are 90 records
6) add 10 records and use RowID
..............you just duplicted 90...99

I have use a GUID [Globally Unique IDentifier]  in my
"multi-user/multi-location" 911 system
something like "User ID" [5 char] the date, the time to 12 digits
I get the actual clock date/time as a floating point number but the "TIMER"
function will work [ticks since midnight]

So, you have a 30 char field as          TP.20000120.123465789012

The chances of 2 people with the same ID, on the same day, at the "exact"
time [calculating PC difference]
..............you do the math.

This works great as "select * from table where GUID=aguid into work"
if no records then do an add other wise do an "update"

You could probably drop the User ID if you want to.......

Besides you know who and when the record was worked in for later reference.


Trey Pattillo
[EMAIL PROTECTED]
http://www.wap3.com

----- Original Message -----
From: Fran Peck <[EMAIL PROTECTED]>
To: Mapinfo List (E-mail) <[EMAIL PROTECTED]>
Sent: Thursday, 20 January, 2000 15:36
Subject: MI Id question thanks


> Thanks to all who responded to my MI ID question. The solution of creating
> an ID column and updating column with ROWID was perfect. Got that project
> done in short order!  I really appreciate the help.
>
> Fran Peck
> Peoria Unified School District
> 6330 W Thunderbird Rd
> Glendale, AZ 85306
> Voice: 623-486-6099
> Fax: 623-486-6111
> Email: [EMAIL PROTECTED]
>
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to