Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 2 of 2 total |
Problem with re-creating primary index |
Wed, Apr 8 2009 7:27 AM | Permanent Link |
Colin | Hi Guys,
I am using the following code... Query1.SQL.Clear; Query1.SQL.Add('DROP INDEX IF EXISTS RemoteSites.Primary;'); Query1.SQL.add('ALTER TABLE "RemoteSites.dat"'); Query1.SQL.Add('add Primary Key(KnownAs,Site);'); Query1.ExecSQL; When I run the code I get the error "Error 11949 - Cannot REDEFINE and existing primary index using the ADD keyword in Alter Table SQL". I thought by deleting the primary code on the first line, I couldn't be redefining the primary index. Am I missing something obvious? Any help appreciated. (Using D5 last DBISAM version) Colin |
Mon, Apr 13 2009 6:22 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Colin,
<< When I run the code I get the error "Error 11949 - Cannot REDEFINE and existing primary index using the ADD keyword in Alter Table SQL". I thought by deleting the primary code on the first line, I couldn't be redefining the primary index. Am I missing something obvious? Any help appreciated. >> It's not that obvious, but DBISAM 4.x requires a primary key/index for every table, so when you drop the existing primary key/index, it will result in DBISAM automatically creating one on the system-defined RecordID field. Thus, you should never use ADD for primary keys in an ALTER TABLE statement, but rather always use REDEFINE. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |