Troubleshooting
Problem
You get error "201: A syntax error has occurred." when trying to create a table.
Symptom
create table t1 (
c1 int,
primary int);
201: A syntax error has occurred.
Error in line 1
Near character position 34
Cause
This could be because you are using the following reserved words as a column name:
- CHECK
- DISTINCT
- FOREIGN
- PRIMARY
- UNIQUE
Resolving The Problem
Although you can use these reserved words as an identifier, syntactic ambiguities can result from using keywords as identifiers in SQL statements. The statement might fail or might not produce the expected results. However, if you must use these reserved words as column names, you can use the following workaround:
Create the table without the column that has the keyword name, then ALTER TABLE to ADD the column with the reserved word. For example:
create table t1 (c1 int);
ALTER TABLE t1 ADD primary int;
Related Information
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21441150