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
 Incorrect syntax

Author  Topic 

kprofgold
Starting Member

15 Posts

Posted - 2011-10-13 : 00:33:01
Please help I am getting an incorrect syntax when trying to create these tables and columns it has been driving me crazy trying to figure it out. I know it may have something to do with the FK but cant figure it out. I believe the issue is within the Employee table. Here is my error and query

Msg 102, Level 15, State 1, Line 16
Incorrect syntax near 'REFERENCES'.
Msg 208, Level 16, State 1, Line 1
Invalid object name 'Employee'.

USE [KudlerFineFoods2]
GO
CREATE TABLE JobTitle
(
JobTitle INT PRIMARY KEY NOT NULL,
EmployerInformationReport varchar(2000) NOT NULL,
JobDescription varchar(2000) NOT NULL,
ExemptOrNonExemptStatus varchar(25) NOT NULL,
)
GO
CREATE TABLE Employee
(
EmployeeID INT PRIMARY KEY NOT NULL,
LastName varchar(100) NOT NULL,
FirstName varchar(100) NOT NULL,
Address varchar(25) NULL,
City varchar(25) NULL,
State char(2) NULL,
TelephoneAreaCode smallint NULL,
TelephoneNumber int NULL,
EmployeeInformationReport varchar(250) NULL,
HireDate date NULL,
Salary money NULL,
Gender char(1) NOT NULL,
Age smallint NULL,
JobTitle INT FOREIGN KEY REFERENCES
GO
INSERT INTO Employee
VALUES (1,'McMullen', 'Eric', '763 Church St.', 'Lemon Grove', 'Ca', '(619)', '5550123', 'Sales Workers', '6/1/2002', '48,000', 'M', '26', 'Bagger')
INSERT INTO Employee
VALUES (2,'Slentz', 'Raj', '123 Torrie Dr.', 'North Clairmont', 'Ca', '(619)', '5550123', 'Officials & Managers', '6/1/2002', '48,000', 'M', '34', 'Asst. Store Manager')
INSERT INTO Employee
VALUES (3,'Broun', 'Erin', '2045 Parkway Apt2B', 'Encinitas', 'Ca', '(760)','5550100', 'Sales Workers', '3/12/2003', '10,530','F', '24', 'Bagger-30hours/week')
INSERT INTO Employee
VALUES (4,'Carpenter', 'Donald', '927 Second St.', 'Encinitas', 'Ca', '(619)','5550154', 'Office/Clerical', '11/1/2003', '15,500', 'M', '18', 'Stocker')
INSERT INTO Employee
VALUES (5,'Esquivez', 'David', '10983 N. Coast Hwy Apt. 902', 'Encinitas', 'Ca', '(760)','5550108', ' Operatives (Semi skilled)', '7/25/2003', '18,500', 'M', '25', 'Asst. butchers and seafood specialists')
INSERT INTO Employee
VALUES (6,'Sharp', 'Nancy', '10793 Montecino Rd.', 'Ramona', 'Ca', '(858)','5550135', 'Sales Workers', '7/12/2003', '21,000', 'F', '24', 'Cashier')
GO
INSERT INTO JobTitle
VALUES('Accounting Clerk', 'Office/Clerical', 'Computes, classifies, records, and verifies numerical data for use in maintaining accounting records.', 'Exempt')
INSERT INTO JobTitle
VALUES('Assistant Manager', 'Officials & Managers', 'Supervises and coordinates activities of workers in department of food store. Assists store manager in daily operations of store.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Bagger', 'Sales Workers', 'Places customer orders in bags. Performs carryout duties for customers.', 'Exempt')
INSERT INTO JobTitle
VALUES('Cashier', 'Sales Workers', 'Operates cash register to itemize and total customer’s purchases in grocery store.', 'Exempt')
INSERT INTO JobTitle
VALUES('Computer Support Specialist', 'Technician', 'Installs, modifies, and makes minor repairs to personal computer hardware and software systems, and provides technical assistance and training to system users.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Director of Finance and Accounting', 'Officials & Managers', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Retail Assistant Bakery and Pastry', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle
VALUES('Retail Assistant Butchers and Seafood Specialists', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle
VALUES('Stocker', 'Office/Clerical', 'Stores, prices and restocks merchandise displays in store.', 'Exempt')
GO

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2011-10-13 : 00:50:58
u forgot closing braces for second table

------------------------------------------------
The answer is always no till than you don't ask.
Go to Top of Page

kprofgold
Starting Member

15 Posts

Posted - 2011-10-13 : 01:20:58
Thank you for your response. I tried that as well and received the error Msg 102, Level 15, State 1, Line 17
Incorrect syntax near ')'. Is this what you were talking about? Here is my query with the bracket after the employee table



USE [KudlerFineFoods2]
GO
CREATE TABLE JobTitle
(
JobTitle INT PRIMARY KEY NOT NULL,
EmployerInformationReport varchar(2000) NOT NULL,
JobDescription varchar(2000) NOT NULL,
ExemptOrNonExemptStatus varchar(25) NOT NULL,
)
GO
CREATE TABLE Employee
(
EmployeeID INT PRIMARY KEY NOT NULL,
LastName varchar(100) NOT NULL,
FirstName varchar(100) NOT NULL,
Address varchar(25) NULL,
City varchar(25) NULL,
State char(2) NULL,
TelephoneAreaCode smallint NULL,
TelephoneNumber int NULL,
EmployeeInformationReport varchar(250) NULL,
HireDate date NULL,
Salary money NULL,
Gender char(1) NOT NULL,
Age smallint NULL,
JobTitle INT FOREIGN KEY REFERENCES
)
GO
INSERT INTO Employee
VALUES (1,'McMullen', 'Eric', '763 Church St.', 'Lemon Grove', 'Ca', '(619)', '5550123', 'Sales Workers', '6/1/2002', '48,000', 'M', '26', 'Bagger')
INSERT INTO Employee
VALUES (2,'Slentz', 'Raj', '123 Torrie Dr.', 'North Clairmont', 'Ca', '(619)', '5550123', 'Officials & Managers', '6/1/2002', '48,000', 'M', '34', 'Asst. Store Manager')
INSERT INTO Employee
VALUES (3,'Broun', 'Erin', '2045 Parkway Apt2B', 'Encinitas', 'Ca', '(760)','5550100', 'Sales Workers', '3/12/2003', '10,530','F', '24', 'Bagger-30hours/week')
INSERT INTO Employee
VALUES (4,'Carpenter', 'Donald', '927 Second St.', 'Encinitas', 'Ca', '(619)','5550154', 'Office/Clerical', '11/1/2003', '15,500', 'M', '18', 'Stocker')
INSERT INTO Employee
VALUES (5,'Esquivez', 'David', '10983 N. Coast Hwy Apt. 902', 'Encinitas', 'Ca', '(760)','5550108', ' Operatives (Semi skilled)', '7/25/2003', '18,500', 'M', '25', 'Asst. butchers and seafood specialists')
INSERT INTO Employee
VALUES (6,'Sharp', 'Nancy', '10793 Montecino Rd.', 'Ramona', 'Ca', '(858)','5550135', 'Sales Workers', '7/12/2003', '21,000', 'F', '24', 'Cashier')
GO
INSERT INTO JobTitle
VALUES('Accounting Clerk', 'Office/Clerical', 'Computes, classifies, records, and verifies numerical data for use in maintaining accounting records.', 'Exempt')
INSERT INTO JobTitle
VALUES('Assistant Manager', 'Officials & Managers', 'Supervises and coordinates activities of workers in department of food store. Assists store manager in daily operations of store.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Bagger', 'Sales Workers', 'Places customer orders in bags. Performs carryout duties for customers.', 'Exempt')
INSERT INTO JobTitle
VALUES('Cashier', 'Sales Workers', 'Operates cash register to itemize and total customer’s purchases in grocery store.', 'Exempt')
INSERT INTO JobTitle
VALUES('Computer Support Specialist', 'Technician', 'Installs, modifies, and makes minor repairs to personal computer hardware and software systems, and provides technical assistance and training to system users.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Director of Finance and Accounting', 'Officials & Managers', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Retail Assistant Bakery and Pastry', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle
VALUES('Retail Assistant Butchers and Seafood Specialists', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle
VALUES('Stocker', 'Office/Clerical', 'Stores, prices and restocks merchandise displays in store.', 'Exempt')
GO
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-13 : 01:57:02
you've not given details of reffered object

irt should be like


USE [KudlerFineFoods2]
GO
CREATE TABLE JobTitle
(
JobTitle INT PRIMARY KEY NOT NULL,
EmployerInformationReport varchar(2000) NOT NULL,
JobDescription varchar(2000) NOT NULL,
ExemptOrNonExemptStatus varchar(25) NOT NULL,
)
GO
CREATE TABLE Employee
(
EmployeeID INT PRIMARY KEY NOT NULL,
LastName varchar(100) NOT NULL,
FirstName varchar(100) NOT NULL,
Address varchar(25) NULL,
City varchar(25) NULL,
State char(2) NULL,
TelephoneAreaCode smallint NULL,
TelephoneNumber int NULL,
EmployeeInformationReport varchar(250) NULL,
HireDate date NULL,
Salary money NULL,
Gender char(1) NOT NULL,
Age smallint NULL,
JobTitle INT FOREIGN KEY REFERENCES JobTitle(JobTitle)
)
GO


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kprofgold
Starting Member

15 Posts

Posted - 2011-10-13 : 02:13:33
I really appreciate your guys' help. This is my first database and I'm trying to figure this out through a book. I'm almost there. I have created the tables and columns now but am receiving this error
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'Bagger' to data type int.
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'Accounting Clerk' to data type int.


USE [KudlerFineFoods2]
GO
CREATE TABLE JobTitle
(
JobTitle INT PRIMARY KEY NOT NULL,
EmployerInformationReport varchar(2000) NOT NULL,
JobDescription varchar(2000) NOT NULL,
ExemptOrNonExemptStatus varchar(25) NOT NULL,
)
GO
CREATE TABLE Employee
(
EmployeeID INT PRIMARY KEY NOT NULL,
LastName varchar(100) NOT NULL,
FirstName varchar(100) NOT NULL,
Address varchar(25) NULL,
City varchar(25) NULL,
State char(2) NULL,
TelephoneAreaCode smallint NULL,
TelephoneNumber int NULL,
EmployeeInformationReport varchar(250) NULL,
HireDate date NULL,
Salary money NULL,
Gender char(1) NOT NULL,
Age smallint NULL,
JobTitle INT FOREIGN KEY REFERENCES JobTitle (JobTitle)
)
GO
INSERT INTO Employee
VALUES (1,'McMullen', 'Eric', '763 Church St.', 'Lemon Grove', 'Ca', '619', '5550123', 'Sales Workers', '6/1/2002', '48,000', 'M', '26', 'Bagger')
INSERT INTO Employee
VALUES (2,'Slentz', 'Raj', '123 Torrie Dr.', 'North Clairmont', 'Ca', '619', '5550123', 'Officials & Managers', '6/1/2002', '48,000', 'M', '34', 'Asst. Store Manager')
INSERT INTO Employee
VALUES (3,'Broun', 'Erin', '2045 Parkway Apt2B', 'Encinitas', 'Ca', '760','5550100', 'Sales Workers', '3/12/2003', '10,530','F', '24', 'Bagger-30hours/week')
INSERT INTO Employee
VALUES (4,'Carpenter', 'Donald', '927 Second St.', 'Encinitas', 'Ca', '619','5550154', 'Office/Clerical', '11/1/2003', '15,500', 'M', '18', 'Stocker')
INSERT INTO Employee
VALUES (5,'Esquivez', 'David', '10983 N. Coast Hwy Apt. 902', 'Encinitas', 'Ca', '760','5550108', ' Operatives (Semi skilled)', '7/25/2003', '18,500', 'M', '25', 'Asst. butchers and seafood specialists')
INSERT INTO Employee
VALUES (6,'Sharp', 'Nancy', '10793 Montecino Rd.', 'Ramona', 'Ca', '858','5550135', 'Sales Workers', '7/12/2003', '21,000', 'F', '24', 'Cashier')
GO
INSERT INTO JobTitle
VALUES('Accounting Clerk', 'Office/Clerical', 'Computes, classifies, records, and verifies numerical data for use in maintaining accounting records.', 'Exempt')
INSERT INTO JobTitle
VALUES('Assistant Manager', 'Officials & Managers', 'Supervises and coordinates activities of workers in department of food store. Assists store manager in daily operations of store.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Bagger', 'Sales Workers', 'Places customer orders in bags. Performs carryout duties for customers.', 'Exempt')
INSERT INTO JobTitle
VALUES('Cashier', 'Sales Workers', 'Operates cash register to itemize and total customer’s purchases in grocery store.', 'Exempt')
INSERT INTO JobTitle
VALUES('Computer Support Specialist', 'Technician', 'Installs, modifies, and makes minor repairs to personal computer hardware and software systems, and provides technical assistance and training to system users.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Director of Finance and Accounting', 'Officials & Managers', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Retail Assistant Bakery and Pastry', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle
VALUES('Retail Assistant Butchers and Seafood Specialists', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle
VALUES('Stocker', 'Office/Clerical', 'Stores, prices and restocks merchandise displays in store.', 'Exempt')
GO
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-13 : 02:31:08
add the required column names after inserts.
ie

INSERT INTO Employee (LastName ,FirstName,....)
VALUES...

....
INSERT INTO JobTitle(jobTitle,...)
VALUES....

.....



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jassi.singh
Posting Yak Master

122 Posts

Posted - 2011-10-13 : 02:39:42
In employee table you specified JobTitle as Int and you are trying to enter string value 'Bagger', You should either change it to varchar in both the table if you want to store string value.

Please mark answer as accepted if it helped you.

Thanks,
Jassi Singh
Go to Top of Page

kprofgold
Starting Member

15 Posts

Posted - 2011-10-13 : 02:48:50
I am still receiving this error
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'Bagger' to data type int.
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'Accounting Clerk' to data type int.

USE [KudlerFineFoods2]
GO
CREATE TABLE JobTitle
(
JobTitle INT PRIMARY KEY NOT NULL,
EmployerInformationReport varchar(2000) NOT NULL,
JobDescription varchar(2000) NOT NULL,
ExemptOrNonExemptStatus varchar(25) NOT NULL,
)
GO
CREATE TABLE Employee
(
EmployeeID INT PRIMARY KEY NOT NULL,
LastName varchar(100) NOT NULL,
FirstName varchar(100) NOT NULL,
Address varchar(25) NULL,
City varchar(25) NULL,
State char(2) NULL,
TelephoneAreaCode smallint NULL,
TelephoneNumber int NULL,
EmployeeInformationReport varchar(250) NULL,
HireDate date NULL,
Salary money NULL,
Gender char(1) NOT NULL,
Age smallint NULL,
JobTitle INT FOREIGN KEY REFERENCES JobTitle (JobTitle)
)
GO
INSERT INTO Employee (EmployeeID, LastName, FirstName, Address, City, State, TelephoneAreaCode, TelephoneNumber, EmployeeInformationReport, HireDate, Salary, Gender, Age, JobTitle)
VALUES (1,'McMullen', 'Eric', '763 Church St.', 'Lemon Grove', 'Ca', '619', '5550123', 'Sales Workers', '6/1/2002', '48,000', 'M', '26', 'Bagger')
INSERT INTO Employee (EmployeeID, LastName, FirstName, Address, City, State, TelephoneAreaCode, TelephoneNumber, EmployeeInformationReport, HireDate, Salary, Gender, Age, JobTitle)
VALUES (2,'Slentz', 'Raj', '123 Torrie Dr.', 'North Clairmont', 'Ca', '619', '5550123', 'Officials & Managers', '6/1/2002', '48,000', 'M', '34', 'Asst. Store Manager')
INSERT INTO Employee (EmployeeID, LastName, FirstName, Address, City, State, TelephoneAreaCode, TelephoneNumber, EmployeeInformationReport, HireDate, Salary, Gender, Age, JobTitle)
VALUES (3,'Broun', 'Erin', '2045 Parkway Apt2B', 'Encinitas', 'Ca', '760','5550100', 'Sales Workers', '3/12/2003', '10,530','F', '24', 'Bagger-30hours/week')
INSERT INTO Employee (EmployeeID, LastName, FirstName, Address, City, State, TelephoneAreaCode, TelephoneNumber, EmployeeInformationReport, HireDate, Salary, Gender, Age, JobTitle)
VALUES (4,'Carpenter', 'Donald', '927 Second St.', 'Encinitas', 'Ca', '619','5550154', 'Office/Clerical', '11/1/2003', '15,500', 'M', '18', 'Stocker')
INSERT INTO Employee (EmployeeID, LastName, FirstName, Address, City, State, TelephoneAreaCode, TelephoneNumber, EmployeeInformationReport, HireDate, Salary, Gender, Age, JobTitle)
VALUES (5,'Esquivez', 'David', '10983 N. Coast Hwy Apt. 902', 'Encinitas', 'Ca', '760','5550108', ' Operatives (Semi skilled)', '7/25/2003', '18,500', 'M', '25', 'Asst. butchers and seafood specialists')
INSERT INTO Employee (EmployeeID, LastName, FirstName, Address, City, State, TelephoneAreaCode, TelephoneNumber, EmployeeInformationReport, HireDate, Salary, Gender, Age, JobTitle)
VALUES (6,'Sharp', 'Nancy', '10793 Montecino Rd.', 'Ramona', 'Ca', '858','5550135', 'Sales Workers', '7/12/2003', '21,000', 'F', '24', 'Cashier')
GO
INSERT INTO JobTitle (JobTitle, EmployerInformationReport, JobDescription, ExemptOrNonExemptStatus)
VALUES('Accounting Clerk', 'Office/Clerical', 'Computes, classifies, records, and verifies numerical data for use in maintaining accounting records.', 'Exempt')
INSERT INTO JobTitle (JobTitle, EmployerInformationReport, JobDescription, ExemptOrNonExemptStatus)
VALUES('Assistant Manager', 'Officials & Managers', 'Supervises and coordinates activities of workers in department of food store. Assists store manager in daily operations of store.', 'Non Exempt')
INSERT INTO JobTitle (JobTitle, EmployerInformationReport, JobDescription, ExemptOrNonExemptStatus)
VALUES('Bagger', 'Sales Workers', 'Places customer orders in bags. Performs carryout duties for customers.', 'Exempt')
INSERT INTO JobTitle (JobTitle, EmployerInformationReport, JobDescription, ExemptOrNonExemptStatus)
VALUES('Cashier', 'Sales Workers', 'Operates cash register to itemize and total customer’s purchases in grocery store.', 'Exempt')
INSERT INTO JobTitle (JobTitle, EmployerInformationReport, JobDescription, ExemptOrNonExemptStatus)
VALUES('Computer Support Specialist', 'Technician', 'Installs, modifies, and makes minor repairs to personal computer hardware and software systems, and provides technical assistance and training to system users.', 'Non Exempt')
INSERT INTO JobTitle (JobTitle, EmployerInformationReport, JobDescription, ExemptOrNonExemptStatus)
VALUES('Director of Finance and Accounting', 'Officials & Managers', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Non Exempt')
INSERT INTO JobTitle (JobTitle, EmployerInformationReport, JobDescription, ExemptOrNonExemptStatus)
VALUES('Retail Assistant Bakery and Pastry', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle (JobTitle, EmployerInformationReport, JobDescription, ExemptOrNonExemptStatus)
VALUES('Retail Assistant Butchers and Seafood Specialists', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle (JobTitle, EmployerInformationReport, JobDescription, ExemptOrNonExemptStatus)
VALUES('Stocker', 'Office/Clerical', 'Stores, prices and restocks merchandise displays in store.', 'Exempt')
GO



Go to Top of Page

kprofgold
Starting Member

15 Posts

Posted - 2011-10-13 : 02:50:20
Jassi that makes sense but I m having trouble trying to figure out how to input that
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-13 : 02:52:50
the order itself is problem. you cant populate Employee before JobTitle as fk is from EMployee to JobTitle ie. JobTitle is the parent.
It has to be populated first and JobTitle values should be generated and those values have to passed for emplyee table jobtitle field

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kprofgold
Starting Member

15 Posts

Posted - 2011-10-13 : 03:05:40
ok I know I may be taking a step backwards but I am getting confused and more errors than before so I backed up and this is what I have. I tried to input the employee values before the jobtitle values but got way more errors than before so i must be doing it wrong. Sorry I am just confused and have never done this before.

USE [KudlerFineFoods2]
GO
CREATE TABLE JobTitle
(
JobTitle varchar(25) PRIMARY KEY NOT NULL,
EmployerInformationReport varchar(2000) NOT NULL,
JobDescription varchar(2000) NOT NULL,
ExemptOrNonExemptStatus varchar(25) NOT NULL,
)
GO
CREATE TABLE Employee
(
EmployeeID INT PRIMARY KEY NOT NULL,
LastName varchar(100) NOT NULL,
FirstName varchar(100) NOT NULL,
Address varchar(25) NULL,
City varchar(25) NULL,
State char(2) NULL,
TelephoneAreaCode smallint NULL,
TelephoneNumber int NULL,
EmployeeInformationReport varchar(250) NULL,
HireDate date NULL,
Salary money NULL,
Gender char(1) NOT NULL,
Age smallint NULL,
JobTitle varchar(25) FOREIGN KEY REFERENCES JobTitle (JobTitle)
)
GO
INSERT INTO Employee
VALUES (1,'McMullen', 'Eric', '763 Church St.', 'Lemon Grove', 'Ca', '619', '5550123', 'Sales Workers', '6/1/2002', '48,000', 'M', '26', 'Bagger')
INSERT INTO Employee
VALUES (2,'Slentz', 'Raj', '123 Torrie Dr.', 'North Clairmont', 'Ca', '619', '5550123', 'Officials & Managers', '6/1/2002', '48,000', 'M', '34', 'Asst. Store Manager')
INSERT INTO Employee
VALUES (3,'Broun', 'Erin', '2045 Parkway Apt2B', 'Encinitas', 'Ca', '760','5550100', 'Sales Workers', '3/12/2003', '10,530','F', '24', 'Bagger-30hours/week')
INSERT INTO Employee
VALUES (4,'Carpenter', 'Donald', '927 Second St.', 'Encinitas', 'Ca', '619','5550154', 'Office/Clerical', '11/1/2003', '15,500', 'M', '18', 'Stocker')
INSERT INTO Employee
VALUES (5,'Esquivez', 'David', '10983 N. Coast Hwy Apt. 902', 'Encinitas', 'Ca', '760','5550108', ' Operatives (Semi skilled)', '7/25/2003', '18,500', 'M', '25', 'Asst. butchers and seafood specialists')
INSERT INTO Employee
VALUES (6,'Sharp', 'Nancy', '10793 Montecino Rd.', 'Ramona', 'Ca', '858','5550135', 'Sales Workers', '7/12/2003', '21,000', 'F', '24', 'Cashier')
GO
INSERT INTO JobTitle
VALUES('Accounting Clerk', 'Office/Clerical', 'Computes, classifies, records, and verifies numerical data for use in maintaining accounting records.', 'Exempt')
INSERT INTO JobTitle
VALUES('Assistant Manager', 'Officials & Managers', 'Supervises and coordinates activities of workers in department of food store. Assists store manager in daily operations of store.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Bagger', 'Sales Workers', 'Places customer orders in bags. Performs carryout duties for customers.', 'Exempt')
INSERT INTO JobTitle
VALUES('Cashier', 'Sales Workers', 'Operates cash register to itemize and total customer’s purchases in grocery store.', 'Exempt')
INSERT INTO JobTitle
VALUES('Computer Support Specialist', 'Technician', 'Installs, modifies, and makes minor repairs to personal computer hardware and software systems, and provides technical assistance and training to system users.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Director of Finance and Accounting', 'Officials & Managers', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Non Exempt')
INSERT INTO JobTitle
VALUES('Retail Assistant Bakery and Pastry', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle
VALUES('Retail Assistant Butchers and Seafood Specialists', 'Operatives (Semi Skilled)', 'Plans and directs the finance and accounting activities for Kudler Fine Foods.', 'Exempt')
INSERT INTO JobTitle
VALUES('Stocker', 'Office/Clerical', 'Stores, prices and restocks merchandise displays in store.', 'Exempt')
GO
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-13 : 05:27:12
you should be doing it btaches


DECLARE @JobTitleID int

INSERT INTO JobTitle
VALUES('Bagger', 'Sales Workers', 'Places customer orders in bags. Performs carryout duties for customers.', 'Exempt')

SET @JobTitleID =SCOPE_IDENTITY()

INSERT INTO Employee
VALUES (1,'McMullen', 'Eric', '763 Church St.', 'Lemon Grove', 'Ca', '619', '5550123', 'Sales Workers', '6/1/2002', '48,000', 'M', '26', @JobTitleID)



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kprofgold
Starting Member

15 Posts

Posted - 2011-10-13 : 22:08:27
Ok so I was given some directions as well by my instructor and based on his directions this is what I have and of course its not working. I just cant figure this damn thing out. Visakh, I'm trying to figure out how to do what you are suggesting as well.

CREATE DATABASE KudlerFineFoods1
GO
USE KudlerFineFoods1
GO
CREATE TABLE JobTitle
(
JobID int PRIMARY KEY NOT NULL,
JobTitle varchar(25) NOT NULL,
EmployerInformationReport varchar(2000) NOT NULL,
JobDescription varchar(2000) NOT NULL,
ExemptOrNonExemptStatus varchar(25) NOT NULL
)

GO

INSERT INTO JobTitle(JobID,JobTitle,EmployerInformationReport,JobDescription,ExemptOrNonExemptStatus)
VALUES (1,'Accounting Clerk','Office/Clerical','Computes, classifies, records, and verifies numerical data for use in maintaining accounting records.','Exempt'),
(2,'Assistant Manager','Officials & Managers','Supervises and coordinates activities of workers in department of food store. Assists store manager in daily operations of store.','Non Exempt')
(3,'Bagger','Sales Workers','Places customer orders in bags. Performs carryout duties for customers.','Exempt'),
(4,'Cashier','Sales Workers','Operates cash register to itemize and total customer’s purchases in grocery store.','Exempt'),
(5,'Computer Support Specialist','Technician','Installs, modifies, and makes minor repairs to personal computer hardware and software systems, and provides technical assistance and training to system users.','Non Exempt'),
(6,'Director of Finance and Accounting','Officials & Managers','Plans and directs the finance and accounting activities for Kudler Fine Foods.','Non Exempt'),
(7,'Retail Assistant Bakery and Pastry','Operatives (Semi Skilled)','Plans and directs the finance and accounting activities for Kudler Fine Foods.','Exempt'),
(8,'Retail Assistant Butchers and Seafood Specialists','Operatives (Semi Skilled)','Plans and directs the finance and accounting activities for Kudler Fine Foods.','Exempt'),
(9,'Stocker','Office/Clerical','Stores, prices and restocks merchandise displays in store.','Exempt');
GO

CREATE TABLE Employee
(
EmployeeID INT PRIMARY KEY NOT NULL,
LastName varchar(100) NOT NULL,
FirstName varchar(100) NOT NULL,
Address varchar(25) NULL,
City varchar(25) NULL,
State char(2) NULL,
TelephoneAreaCode smallint NULL,
TelephoneNumber int NULL,
HireDate date NULL,
Salary money NULL,
Gender char(1) NOT NULL,
Age smallint NULL,
JobID int NOT NULL
FOREIGN KEY REFERENCES JobTitle(JobID)
)
GO
INSERT INTO Employee (EmployeeID,LastName,FirstName,Address,City,State,TelephoneAreaCode,TelephoneNumber,HireDate,Salary,Gender,Age,JobID)
VALUES (1001,'McMullen','Eric','763 Church St.','Lemon Grove','Ca',619,5550123,'6/1/2002', '48,000', 'M', 26,1),
(1002,'Slentz','Raj','123 Torrie Dr.','North Clairmont','Ca',619,5550123,'6/1/2002','48,000','M',34,2),
(1003,'Broun','Erin','2045 Parkway Apt2B','Encinitas','Ca',760,5550100,'3/12/2003','10,530','F',24,3),
(1004,'Carpenter','Donald','927 Second St.','Encinitas','Ca',619,5550154,'11/1/2003','15,500','M',18,9),
(1005,'Esquivez','David','10983 N. Coast Hwy Apt. 902','Encinitas','Ca',760,5550108,'7/25/2003','18,500','M',25,8),
(1006,'Sharp','Nancy','10793 Montecino Rd.','Ramona','Ca',858,'5550135','7/12/2003','21,000','F',24,4);
GO
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-14 : 01:41:23
missed a few commas and also fields didnt have enough lengths to hold data passed



CREATE TABLE JobTitle
(
JobID int PRIMARY KEY NOT NULL,
JobTitle varchar(100) NOT NULL,
EmployerInformationReport varchar(2000) NOT NULL,
JobDescription varchar(2000) NOT NULL,
ExemptOrNonExemptStatus varchar(25) NOT NULL
)

GO

INSERT INTO JobTitle(JobID,JobTitle,EmployerInformationReport,JobDescription,ExemptOrNonExemptStatus)
VALUES (1,'Accounting Clerk','Office/Clerical','Computes, classifies, records, and verifies numerical data for use in maintaining accounting records.','Exempt'),
(2,'Assistant Manager','Officials & Managers','Supervises and coordinates activities of workers in department of food store. Assists store manager in daily operations of store.','Non Exempt'),
(3,'Bagger','Sales Workers','Places customer orders in bags. Performs carryout duties for customers.','Exempt'),
(4,'Cashier','Sales Workers','Operates cash register to itemize and total customer’s purchases in grocery store.','Exempt'),
(5,'Computer Support Specialist','Technician','Installs, modifies, and makes minor repairs to personal computer hardware and software systems, and provides technical assistance and training to system users.','Non Exempt'),
(6,'Director of Finance and Accounting','Officials & Managers','Plans and directs the finance and accounting activities for Kudler Fine Foods.','Non Exempt'),
(7,'Retail Assistant Bakery and Pastry','Operatives (Semi Skilled)','Plans and directs the finance and accounting activities for Kudler Fine Foods.','Exempt'),
(8,'Retail Assistant Butchers and Seafood Specialists','Operatives (Semi Skilled)','Plans and directs the finance and accounting activities for Kudler Fine Foods.','Exempt'),
(9,'Stocker','Office/Clerical','Stores, prices and restocks merchandise displays in store.','Exempt');
GO

CREATE TABLE Employee
(
EmployeeID INT PRIMARY KEY NOT NULL,
LastName varchar(100) NOT NULL,
FirstName varchar(100) NOT NULL,
Address varchar(100) NULL,
City varchar(25) NULL,
State char(2) NULL,
TelephoneAreaCode smallint NULL,
TelephoneNumber int NULL,
HireDate date NULL,
Salary money NULL,
Gender char(1) NOT NULL,
Age smallint NULL,
JobID int NOT NULL
FOREIGN KEY REFERENCES JobTitle(JobID)
)
GO
INSERT INTO Employee (EmployeeID,LastName,FirstName,Address,City,State,TelephoneAreaCode,TelephoneNumber,HireDate,Salary,Gender,Age,JobID)
VALUES (1001,'McMullen','Eric','763 Church St.','Lemon Grove','Ca',619,5550123,'6/1/2002', '48,000', 'M', 26,1),
(1002,'Slentz','Raj','123 Torrie Dr.','North Clairmont','Ca',619,5550123,'6/1/2002','48,000','M',34,2),
(1003,'Broun','Erin','2045 Parkway Apt2B','Encinitas','Ca',760,5550100,'3/12/2003','10,530','F',24,3),
(1004,'Carpenter','Donald','927 Second St.','Encinitas','Ca',619,5550154,'11/1/2003','15,500','M',18,9),
(1005,'Esquivez','David','10983 N. Coast Hwy Apt. 902','Encinitas','Ca',760,5550108,'7/25/2003','18,500','M',25,8),
(1006,'Sharp','Nancy','10793 Montecino Rd.','Ramona','Ca',858,'5550135','7/12/2003','21,000','F',24,4);
GO



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kprofgold
Starting Member

15 Posts

Posted - 2011-10-14 : 02:07:11
It worked!! Thank you so much I really appreciate your help.
Go to Top of Page

topconlacj
Starting Member

1 Post

Posted - 2011-10-21 : 21:15:01
Hi,

I agreed with you. Any way, your points of view make me thinking about some thing for my project.

Pls try to keep posting. Tks and best regards
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-22 : 04:46:35
quote:
Originally posted by topconlacj

Hi,

I agreed with you. Any way, your points of view make me thinking about some thing for my project.

Pls try to keep posting. Tks and best regards





------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -