Click here to Skip to main content
14,669,375 members
Rate this:
Please Sign up or sign in to vote.
See more:
CREATE DATABASE ORG;
USE ORG;
CREATE TABLE Worker (
WORKER_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
FIRST_NAME CHAR(25),
LAST_NAME CHAR(25),
SALARY INT(15),
JOINING_DATE DATETIME,
DEPARTMENT CHAR(25)
);

What I have tried:

For this i am getting Msg 102, Level 15, State 1, Line 4
Incorrect syntax near ','. error give the solution for this
Posted
Updated 16-Jul-20 21:56pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

AUTO_INCREMENT is MySql syntax, not Sql Server.
Try this:
WORKER_ID INT NOT NULL PRIMARY KEY IDENTITY(1,1),

But quite what you expect
SALARY INT(15),
To do is anybodies guess.

At a guess, you've found a DB design for MySql and assumed it's the same in SQL: it isn't.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100