SQL question

  • Thread starter Thread starter shaggles
  • Start date Start date
S

shaggles

I'm having trouble with a Create Table query. I can't set
the field size. I think the query should look liek this:
CREATE TABLE tblClients
(Last_Name TEXT 25,
First_Name TEXT 25,
SSN INT 9);
But I keep getting an error message that say "Syntax error
in the sql statement." What am I doing wrong?
 
I'm having trouble with a Create Table query. I can't set
the field size. I think the query should look liek this:
CREATE TABLE tblClients
(Last_Name TEXT 25,
First_Name TEXT 25,
SSN INT 9);
But I keep getting an error message that say "Syntax error
in the sql statement." What am I doing wrong?

I'd STRONGLY suggest storing the SSN in a TEXT 9 rather than an INT. I
don't think the DDL query will honor a size for an INT in any case,
which is probably the source of the error.
 
shaggles said:
I'm having trouble with a Create Table query. I can't set
the field size. I think the query should look liek this:
CREATE TABLE tblClients
(Last_Name TEXT 25,
First_Name TEXT 25,
SSN INT 9);
But I keep getting an error message that say "Syntax error
in the sql statement." What am I doing wrong?


Try it this way:

CREATE TABLE tblClients
(Last_Name TEXT(25),
First_Name TEXT(25),
SSN LONG);

INT is too small for an SSN, so this will need LONG.

Text datatypes must have their length declaration enclosed in () on a
CREATE TABLE statement.


Sincerely,

Chris O.
 
Back
Top