0

I am a new SQL user and I have created my code but when I execute it I get this error :

Msg 2714, Level 16, State 6, Line 1
There is already an object named 'Job_Title' in the database.

I do not understand why I keep getting this same error.
Here is my code:

CREATE TABLE Job_Title
(
Job_ID			int			NOT NULL
	PRIMARY KEY(Job_ID),
EEO1_Class		varchar(20)	NOT NULL,
Job_Title		varchar(40) NOT NULL,
Job_Descrip		varchar(100)NOT NULL,
Status			varchar(10)	NOT NULL
)

CREATE TABLE Employee
(
Emp_ID			int			NOT NULL
	PRIMARY KEY(Emp_ID),
Last_Name		varchar(50) NOT NULL,
First_Name		varchar(50)	NOT NULL,
Address			varchar(50)	NOT NULL,
City			varchar(25)	NOT NULL,
State			varchar(20)	NOT NULL,
Phone_AC		char(3)		NOT NULL,
Phone_Num		char(7)		NOT NULL,
Ssn				char(9)		NOT NULL,
Hire_Date		datetime	NOT NULL,
Salary			numeric(6,2)	NOT NULL,
Gender			varchar(6)	NOT NULL,
Birthday		datetime	NOT NULL,
Job_ID			int	FOREIGN KEY REFERENCES Job_Title (Job_ID)
)

And a few examples of my INSERT statements:

INSERT INTO Employee (Emp_ID,Last_Name,First_Name,Address,City,State,Phone_AC,
	Phone_Num,Ssn,Hire_Date,Salary,Gender,Birthday,Job_ID)
VALUES (62683,'Edelman','Glenn','175 Bishop Lane','La Jolla','California',619,555-0199,112333445,
	10/07/2003,11.25,'male',11/02/1981,004)


INSERT INTO Job_Title (Job_ID,EEO1_Class,Job_Title,Job_Descrip,Status)
VALUES (001,'Office/Clerical','Accounting Clerk','Computes, classifies, records, and verifies numerical
	data for use in maintaining accounting records','NonExempt')

Thanks for your help!

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by spthorn
0

I'm guessing you are executing the CREATE code over again. Be sure to DROP TABLE Job_Title before creating it again.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.