Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DROP INDEX foo not working 1

Status
Not open for further replies.

Ronin441

Programmer
Feb 22, 2002
128
AU
I have a line of code that says:
Code:
  DM.LeagueDatabase.Execute('CREATE INDEX Game_ID ON ' + TableName + ' (Game, ID);', nil, False, nil);
It works fine, and the Game_ID secondary index is duly created. I have another line that says:
Code:
  DM.LeagueDatabase.Execute('DROP INDEX Game_ID;', nil, False, nil);
It fails, with "Unexpected end of command. Token: Game_ID Line number: 1".

The table is a BDE table, stored on the local disk. I believe the DROP INDEX is failing because although there is an index called Game_ID associated with table [mytablename], the DROP INDEX command does not take a table name, and thus I think it's not finding the index because I have no way to tell it the table name.

(a) Can anyone tell me what the correct SQl syntax to drop the index would be, or (b) can anyone suggest a non-SQL way to delete the secondary index? -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Try something like this.
Code:
DM.LeagueDatabase.Execute ('DROP INDEX ' + TableName + '.Game_ID;', nil, False, nil );
The syntax has been extended for Paradox tables so that the table name is passed to the Paradox engine:

DROP INDEX tablename.indexname

Andrew

 
The Database Desktop has good Help. I learnt quite a lot from it.

Look in Contents | SQL | Using Local SQL | Data Definition Language | DDL Statements | DROP INDEX


Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top