Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Why I get this sql error when creating a table?

Author  Topic 

NewToSQLserver
Starting Member

6 Posts

Posted - 2010-12-17 : 03:59:46
Hello; Any help is really appreciated.
I ran this script:
CREATE DATABASE OrdersDB
USE OrdersDB
CREATE TABLE Orders
(
Order_ID INT IDENTITY(1, 1) NOT NULL,
OrderDate VARCHAR(12) NULL,
OrderPrice Integer(10) NULL, /*I HAVE no idea why this is not working =( */
Customer VARCHAR(20) NULL,
)

I don't know why I get this error: Msg 2716, Level 16, State 1, Line 1
Column, parameter, or variable #3: Cannot specify a column width on data type int.

Something is wrong with the line: OrderPrice Integer(10) NULL,

Please let me know what the problem is.
Thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-12-17 : 04:13:45
The error already told you:
Cannot specify a column width on data type int.

Solution:
OrderPrice INT NULL,

Looks like you are coming from MYSQL or so...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -