Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
1.00/5 (1 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

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

But quite what you expect
SQL
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900