• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

creating tables

how can i create interbase table

can you correct this one.

   Query1.SQL.clear;
   Query1.SQL.Add('CREATE TABLE '+EMPRECORD+' (');
   Query1.SQL.Add('BADGENO CHAR(6),');
   Query1.SQL.Add('FIRSTNAME CHAR(50),');
   Query1.SQL.Add('MIDDLENAME CHAR(50),');
   Query1.SQL.Add('LASTNAME CHAR(50),');
   Query1.SQL.Add('BDATE TIMESTAMP,');
   Query1.SQL.Add('DEPARTMENT CHAR(70),');
   Query1.SQL.Add('PLANTNAME CHAR(50),');
   Query1.SQL.Add('SHIFTCODE CHAR(10),');
   Query1.SQL.Add('PICTURE CHAR(200))');
   Query1.ExecSQL;

   Query1.SQL.clear;
   Query1.SQL.Add('CREATE UNIQUE INDEX EMPRECORD_BADGENO');
   Query1.SQL.Add('ON '+EMPRECORD);
   Query1.SQL.Add('{"BADGENO"}');
   Query1.ExecSQL;


whats the error of my code?
how can i create indexes?
how can i make a 3 field unique?

can you give me a sample working codes please.

0
ryan_sabarre
Asked:
ryan_sabarre
  • 2
1 Solution
 
ryan_sabarreAuthor Commented:
help me
0
 
kacorretiredCommented:
Hi ryan_sabarre,

1. whats the error of my code?
try
  Query1.SQL.clear;
  Query1.SQL.Add('CREATE UNIQUE INDEX EMPRECORD_BADGENO');
  Query1.SQL.Add('ON EMPRECORD (BADGENO)');
  Query1.ExecSQL;

2. how can i create indexes?
CREATE [UNIQUE] [ASC[ENDING] | DESC[ENDING]] INDEX index
ON table ( col [, col …]);

3. how can i make a 3 field unique?
CREATE UNIQUE INDEX index_name ON table_name (field1, field2, field3);

I hope it helps
wbr
Janos
0
 
kacorretiredCommented:
2. how can i create indexes?
CREATE [UNIQUE] [ASC[ENDING] | DESC[ENDING]] INDEX index
ON table ( col1, col 2, ...);

sorry for the mistake

Janos

0
 
CleanupPingCommented:
ryan_sabarre:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now