Solved

SQL Server 2005 datetime syntax error when creating a table

Posted on 2012-04-13
3
286 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 250 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now