Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Designing Your Database » Designing the database table properties

Choosing column names Next Page

Choosing data types for columns


The following data types are available in SQL Anywhere:

For more information about data types, see SQL Data Types.

Any of the character or binary string data types such as CHAR, VARCHAR, LONG VARCHAR, NCHAR, BINARY, VARBINARY, and so on, can be used to store large objects such as images, word-processing documents, and sound files.

For more information about BLOB storage, see Storing BLOBs in the database.

NULL and NOT NULL

If the column value is mandatory for a row, you define the column as being NOT NULL. Otherwise, the column is allowed to contain the NULL value, which represents no value. The default in SQL Anywhere is to allow NULL values, but you should explicitly declare columns NOT NULL unless there is a good reason to allow NULL values.

The SQL Anywhere sample database has a table called Departments, which has columns named DepartmentID, DepartmentName, and DepartmentHeadID. Its definition is as follows:

Column Data type Size Null/not null Constraint
DepartmentID integer NOT NULL None
DepartmentName char 40 NOT NULL None
DepartmentHeadID integer NULL None

If you specify NOT NULL, a column value must be supplied for every row in the table.

For more information about the NULL value, see NULL value. For information on its use in comparisons, see Search conditions.


Storing BLOBs in the database