All Forums Database
StickeyB 1 post Joined 06/11
22 Jan 2013
ERROR 3070 when creating a table

Hi
When I run the following code in SQL Assistant;
 
CREATE TABLE RL_Comments
(
uidComments AS DECIMAL(5,0) NOT NULL,
dteComments AS TIMESTAMP,
 
Account_Number AS DECIMAL(8,0),
Sort_Code AS DECIMAL(6,0),
Excess_Explanation AS VARCHAR(MAX),
Comments AS VARCHAR(MAX),
Sanction_Ref AS VARCHAR(MAX)
Total_Limit_Amt AS DECIMAL(15,0),
Sanction_Expiry AS DATE,
Diary_Date AS DATE,
Excess_Report AS VARCHAR(5),
User_Ref AS VARCHAR(50)
)
PRIMARY INDEX(uidComments)
 
I get the following error;
3707:  Syntax error, expected something like a 'TRANSACTIONTIME' keyword between the 'AS' keyword and the 'DECIMAL' keyword.
 
Please can someone let me know what is going on?
 
Thanks

Qaisar Kiani 337 posts Joined 11/05
29 Jan 2013

First of all you need to take out the AS keywords before the data type name.
Secondly VARCHAR(MAX) is not a datatype - you need to mention some numeric value instead of MAX.
Something like this will work for you...

CREATE TABLE RL_Comments
(
uidComments  DECIMAL(5,0) NOT NULL,
dteComments  TIMESTAMP,
Account_Number  DECIMAL(8,0),
Sort_Code  DECIMAL(6,0),
Excess_Explanation  VARCHAR(200),
Comments  VARCHAR(200),
Sanction_Ref  VARCHAR(200),
Total_Limit_Amt  DECIMAL(15,0),
Sanction_Expiry  DATE,
Diary_Date  DATE,
Excess_Report  VARCHAR(5),
User_Ref  VARCHAR(50)
)
PRIMARY INDEX(uidComments)

 

You must sign in to leave a comment.