?
Solved

SQL PERVASIVE CREATING INDEX GIVES ERROR IN VB6

Posted on 2011-02-19
7
Medium Priority
?
597 Views
Last Modified: 2012-06-27
I use this to create table , works ok
        mystring = "DSN=BIAPRO"          
        dbconn.Open mystring '
        adocat.ActiveConnection = dbconn
        On Error GoTo NoExist                'IF NOT IN TABLE not to delete thus
        klant$ = "MUT01"
        dbconn.Execute ("DROP TABLE " & klant$)

NoExist:
'======
    On Error GoTo Foutje
    strSQL = "CREATE TABLE " & klant$ & "("
    strSQL = strSQL & "MutRecord identity,"
    strSQL = strSQL & "MutYear char(2) NOT NULL,"
    strSQL = strSQL & "MutKlant char(3) NOT NULL,"
    strSQL = strSQL & "MutBoek char(2) NOT NULL,"
    strSQL = strSQL & "MutStuk char(6) NOT NULL,"
    strSQL = strSQL & "MutDate char(6) NOT NULL,"
    strSQL = strSQL & "MutPlace char(1) NOT NULL,"
    strSQL = strSQL & "MutRek char(4) NOT NULL,"
    strSQL = strSQL & "MutBtwFlag char(1) NOT NULL,"
    strSQL = strSQL & "MutBedrag FLOAT NOT NULL,"
    strSQL = strSQL & "MutBtw FLOAT NOT NULL,"
    strSQL = strSQL & "MutReden char(55) NOT NULL,"
    strSQL = strSQL & "wenkilos real NOT NULL,"
    strSQL = strSQL & "MutNewkey char(13) NOT NULL,"
    strSQL = strSQL & "FREEMORE char(151) NOT NULL)"
    dbconn.Execute (strSQL)                 '   ctreate tabel first


but then i need to create index, I do like this in 3 steps

 strSQL = "CREATE UNIQUE INDEX MutRecord ON MUT01 (MutRecord)"
 dbconn.Execute (strSQL)
'''GIVES ERROR  ""

 strSQL = "CREATE INDEX MutNewkey ON  MUT01 (MutNewkey)"
 dbconn.Execute (strSQL)
'''GIVES ERROR  ""

 strSQL = "CREATE INDEX MutBoek  ON  MUT01 (MutBoek)"
 dbconn.Execute (strSQL)
'''GIVES ERROR  ""

0
Comment
Question by:BIAPRO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 18

Expert Comment

by:mirtheil
ID: 34934207
What error?  
You probably don't need to create the key on MutRecord since the field is an Identity and the field should already have an index.  

If you run the queries through PCC, do they work?  
0
 

Author Comment

by:BIAPRO
ID: 34934247
Since I could create the table in my source, after that i entered manualy the index using the pervasive console,
BUT!  i have mut01  upto mut99  and preferre not to do this by hand 99 times

index.jpg
table-names.jpg
0
 
LVL 28

Expert Comment

by:Bill Bach
ID: 34934291
Fyi -- since both field names and index names are stored in the same table (X$File), you cannot have indices with the same names as fields.

I echo Mirtheil's sentiment that you shouldn't need the first one, because of the Field type.
 
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:BIAPRO
ID: 34934339
Ok did retry with only

the get error still:

error.jpg
0
 

Author Comment

by:BIAPRO
ID: 34934345
skipped the 1st index, then got the attached error number
 strSQL = "CREATE INDEX MutNewkey ON  MUT01 (MutNewkey)"
 dbconn.Execute (strSQL)
0
 
LVL 28

Accepted Solution

by:
Bill Bach earned 2000 total points
ID: 34934529
Did you try changing the index name yet?  Add a prefix like "I_" to the start of the index name to make it unique.
0
 

Author Comment

by:BIAPRO
ID: 34934613
Bingo!   that did  the trick!, and true I see the 1st key index generated without my call for key autoinc
Thanks again Bill,

Regards Jack (aruba)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question