ODBC and JDBC Guide
Table Of Contents
- Chapter 1 Introduction
- Chapter 2 Accessing external SQL data sources
- Chapter 3 Installing FileMaker ODBC client drivers
- Chapter 4 Using ODBC to share FileMaker data
- Chapter 5 Installing FileMaker JDBC client drivers
- Chapter 6 Using JDBC to share FileMaker data
- Chapter 7 Supported standards
- Chapter 8 Reference Information
- Index
Chapter 7 | Supported standards 44
Examples
ALTER TABLE statement
Use the ALTER TABLE statement to change the structure of an existing table in a database file.
You can modify only one column in each statement. The formats of the ALTER TABLE statement
are:
ALTER TABLE table_name ADD [COLUMN] column_definition
ALTER TABLE table_name DROP [COLUMN] unqualified_column_name
ALTER TABLE table_name ALTER [COLUMN] column_definition SET DEFAULT expr
ALTER TABLE table_name ALTER [COLUMN] column_definition DROP DEFAULT
You must know the table’s structure and how you want to modify it before using the ALTER TABLE
statement.
Examples
Note SET DEFAULT and DROP DEFAULT do not affect existing rows in the table, but change the
default value for rows that are subsequently added to the table.
Using Sample SQL
text column CREATE TABLE T1 (C1 VARCHAR, C2 VARCHAR (50), C3 VARCHAR (1001),
C4 VARCHAR (500276))
text column, NOT NULL CREATE TABLE T1NN (C1 VARCHAR NOT NULL, C2 VARCHAR (50) NOT NULL,
C3 VARCHAR (1001) NOT NULL, C4 VARCHAR (500276) NOT NULL)
numeric column CREATE TABLE T2 (C1 DECIMAL, C2 DECIMAL (10,0), C3 DECIMAL (7539,2),
C4 DECIMAL (497925,301))
date column CREATE TABLE T3 (C1 DATE, C2 DATE, C3 DATE, C4 DATE)
time column CREATE TABLE T4 (C1 TIME, C2 TIME, C3 TIME, C4 TIME)
timestamp column CREATE TABLE T5 (C1 TIMESTAMP, C2 TIMESTAMP, C3 TIMESTAMP,
C4 TIMESTAMP)
column for container field CREATE TABLE T6 (C1 BLOB, C2 BLOB, C3 BLOB, C4 BLOB)
column for external
storage container field
CREATE TABLE T7 (C1 BLOB EXTERNAL 'Files/MyDatabase' SECURE)
CREATE TABLE T8 (C1 BLOB EXTERNAL 'Files/MyDatabase' OPEN
'Objects')
To Sample SQL
add columns ALTER TABLE Salespeople ADD C1 VARCHAR
remove columns ALTER TABLE Salespeople DROP C1
set the default value for a
column
ALTER TABLE Salespeople ALTER Company SET DEFAULT 'FileMaker'
remove the default value
for a column
ALTER TABLE Salespeople ALTER Company DROP DEFAULT