• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 307
  • Last Modified:

SQL Server 2005 datetime syntax error when creating a table

Receiving Error
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near 'DATETIME'.
sql error
When trying to create a sample table using SQL Management Studio/SQL Server Express 2005.


CREATE TABLE SAMPLE
(
      ID        int primary key,
      NAME            VARCHAR(10),
      GENDER      CHAR(1),
      DOB DATE    DATETIMEl,
      SALARY            MONEY
);
0
aacrz
Asked:
aacrz
  • 2
1 Solution
 
Simone BSenior E-Commerce AnalystCommented:
You need to change the column name DOB DATE to either [DOB DATE] or DOB or DOBDate. The space is causing the problem.
0
 
Simone BSenior E-Commerce AnalystCommented:
Also you have the data type as DATETIME1. It should be DATETIME.
0
 
aacrzAuthor Commented:
Thank you for the quick solution
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now