Ross,

I've not done this programmatically before but, if I did, below is how
I'd do it.  Not sure whether the Obj column is protected in a "drop" so
I've put the test in for it.

Of coursre, you'd well back up your table before trying it!!!!!

HTH

Terry
___________________________________
Dim     lnNumCols, lnColNum As SmallInt
        lcColName, lcCol as String

Open Table "YourTable" 
lnNumCols = TableInfo( "YourTable", TAB_INFO_NCOLS)
For lnColNum = 1 to lnNumCols
  lcCol = "Col" + Rtrim$( Str$( lnColNum))
  If Ucase$( lcColName) <> "OBJ" then
        lcColName = ColumnInfo( "YourTable", lcColName, COL_INFO_NAME)
        Alter Table YourTable Drop lcColName
  End If
Next
Alter table YourTable Add NewCol ... Etc.
         

-----Original Message-----
From: Ross Nixon [mailto:[EMAIL PROTECTED] 
Sent: 21 June 2005 04:01
To: Terry McDonnell
Subject: MI-L Drop and replace all columns?

I want to Alter a table by dropping all existing columns (without losing
the objects) and add several new columns.
Can I do this in one or two mapbasic "Alter Table" statements?

Thanks,
Ross Nixon

Manawatu Aerial Photo Services
P.O. Box 75
Palmerston North
www.forestrymaps.co.nz
Ph/Fax.  06 355 1431

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 16847

Reply via email to