user1026448
user1026448

Reputation: 79

SQL syntax, Create Table, Advantage Database

I have to create a table in the Advantage Database Architect - the SQL code that I have used before in an older project is (simplified version)

CREATE TABLE IF NOT EXISTS "SomacountData"
(
   "Index" AUTOINC,
   "Data" BLOB,
   "Section" INTEGER DEFAULT -1,
   "factor" FLOAT,
   "ThresHold" FLOAT DESCRIPTION "Calculated Threshold",
PRIMARY KEY ("Index") COMPRESS NONE
DESCRIPTION "SomacountData"
LANGUAGE "ANSI Standard" SORT "Default Order"
USER MAJOR VERSION 1
USER MINOR VERSION 4
);

In the Architect this appears to be somewhat more involved - suggestions apreciated.

Upvotes: 1

Views: 1595

Answers (2)

Jens Mühlenhoff
Jens Mühlenhoff

Reputation: 14873

Some pointers:

  • FLOAT is probably best mapped to DOUBLE.
  • Setting the DEFAULT and specifying the primary index requires additional EXECUTE sp_ModifyFieldProperty statements (see Documentation)
  • I don't think there is a DESCRIPTION in ADS.
  • IF NOT EXISTS can be solved in different ways, if you have a dictionary you can query the system.tables internal table of the dictionary. If you don't you can just ignore the creation error by using TRY CREATE TABLE ... CATCH ALL END TRY.

If you have any specific question you should create a new question on SO.

UPDATE:

You can also use the integrated table designer and dump the table code to SQL, but that won't solve your IF NOT EXISTS problem.

Upvotes: 1

6D65
6D65

Reputation: 795

Where is your foreign key? Or this is your only table. Foreign keys are crucial in SQL, relational algebra does not work without them. Also i would use more constraints as NOT NULL.

Upvotes: 0

Related Questions