[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SQL Server 2005 datetime syntax error when creating a table

Posted on 2012-04-13
3
Medium Priority
?
304 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 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

656 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