Paradox를 이용해서 어플리케이션을 만들고 있습니다..
프로그램내에서 테이블을 생성하려고 하는데..
몇가지 의문사항이 있어어요..
1. 필드타입중에 자동증가타입으로 필드를 만드려면 필드타입을 뭘로 줘야 하나요??
Serial, Sequence.. 기타 등등 별 수작을 부려봤는데 안 되네요.. ㅠ.ㅠ
2. Primary Key외에 다른 필드들에 Index를 걸려고 하는데.. 어떻게 해야 하나요??
Create Index.. 어쩌고 저쩌고 하면 될거라 생각했는데.. 안 되네요..
SQL Explorer에서 사용하는 SQL문법을 몰라서 생기는 문제 같은데..
SQL Explorer에서 쓰는 문법에 관한 도움말 같은게 있는지요??
고수님들의 조언 부탁드립니다..
즐코~ 아래는 인덱스 생성부분에 대한 도움말 내용입니다.
CREATE INDEX enables users to create indexes on tables using the following syntax:
CREATE INDEX index_name ON table_name (column [, column ...])
Using CREATE INDEX is the only way to create indexes for dBASE tables. For example, the following statement creates an index on a dBASE table:
CREATE INDEX NAMEX ON "employee.dbf" (LAST_NAME)
Paradox table users can create only secondary indexes with CREATE INDEX. Primary Paradox indexes can be created only by specifying a PRIMARY KEY constraint when creating a new table with CREATE TABLE.
Note: The index created in nonmaintained, nonunique, not case-sensitive, and in ascending order. If the table has a primary key, then a maintained index is created.
CREATE TABLE is supported with the following limitations:
Column definitions based on domains are not supported.
Constraints are limited to PRIMARY KEY for Paradox tables. Constraints are unsupported in dBASE tables.
For example, the following statement creates a Paradox table with a PRIMARY KEY constraint on the LAST_NAME and FIRST_NAME columns:
CREATE TABLE "employee.db"
(
LAST_NAME CHAR(20),
FIRST_NAME CHAR(15),
SALARY NUMERIC(10,2),
DEPT_NO SMALLINT,
PRIMARY KEY(LAST_NAME, FIRST_NAME)
)
The same statement for a dBASE table should omit the PRIMARY KEY definition:
CREATE TABLE "employee.dbf"
(
LAST_NAME CHAR(20),
FIRST_NAME CHAR(15),
SALARY NUMERIC(10,2),
DEPT_NO SMALLINT
)
Creating Paradox and dBASE tables
You create a Paradox or dBASE table using Local SQL by specifying the file extension when naming the table:
".DB" for Paradox tables
".DBF" for dBASE tables
If you omit the file extension for a local table name, the table created is the table type specified in the Default Driver setting in the System page of the BDE Configuration Utility.
Data type mappings for CREATE TABLE
The following table lists SQL syntax for data types used with CREATE TABLE, and describes how those types are mapped to Paradox and dBASE types by the BDE:
SQL Syntax BDE Logical Paradox dBASE
SMALLINT fldINT16 Short Number (6,10)
INTEGER fldINT32 Long Integer Number (20,4)
DECIMAL(x,y) fldBCD BCD N/A
NUMERIC(x,y) fldFLOAT Number Number (x,y)
FLOAT(x,y) fldFLOAT Number Float (x,y)
CHARACTER(n) fldZSTRING Alpha Character
VARCHAR(n) fldZSTRING Alpha Character
DATE fldDATE Date Date
BOOLEAN fldBOOL Logical Logical
BLOB(n,1) fldstMEMO Memo Memo
BLOB(n,2) fldstBINARY Binary Binary
BLOB(n,3) fldstFMTMEMO Formatted memo N/A
BLOB(n,4) fldstOLEOBJ OLE OLE
BLOB(n,5) fldstGRAPHIC Graphic N/A
TIME fldTIME Time N/A
TIMESTAMP fldTIMESTAMP Timestamp N/A
MONEY fldFLOAT, fldstMONEY Money Number (20,4)
AUTOINC fldINT32, fldstAUTOINC Autoincrement N/A
BYTES(n) fldBYTES(n) Bytes N/A
x = precision (default: specific to driver)
y = scale (default: 0)
n = length in bytes (default: 0)
1-5 = BLOB subtype (default: 1)