Solved

SQL Server 2005 datetime syntax error when creating a table

Posted on 2012-04-13
3
300 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

688 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