[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SQL Server 2005 datetime syntax error when creating a table

Posted on 2012-04-13
3
Medium Priority
?
305 Views
Last Modified: 2012-04-13
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
Comment
Question by:aacrz
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
Simone B earned 500 total points
ID: 37843794
You need to change the column name DOB DATE to either [DOB DATE] or DOB or DOBDate. The space is causing the problem.
0
 
LVL 11

Expert Comment

by:Simone B
ID: 37843798
Also you have the data type as DATETIME1. It should be DATETIME.
0
 

Author Closing Comment

by:aacrz
ID: 37843812
Thank you for the quick solution
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

826 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question