Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Error message of invaild data type in SQL Server Management Studio Express

Avatar of Jamie Poole
Jamie Poole asked on
Microsoft SQL Server 2005SQL
4 Comments1 Solution1538 ViewsLast Modified:
I am getting an error message iwhen I try to execute this statement. I am taking a course and this is the sample database to work with throughout the chapter, so this is copied straight from the book. Please tell me I have copied something down wrong.


/*------------------------
CREATE TABLE DEPARTMENT(
	DepartmentName	VARCHAR			NOT NULL, 
	BudgetCode		Char(30)		NOT NULL, 
	OfficeNumber	Char(15)		NOT NULL, 
	Phone			Char(12)		NOT NULL,
	CONSTRAINT		DEPARTMENT_PK	PRIMARY KEY (DepartmentName
);
 
CREATE TABLE EMPLOYEE(
	EmployeeNumber	Int				NOT NULL IDENTITY (1,1)
	FirstName		Char(25)		NOT NULL,
	LastName		Char(25)		NOT NULL,
	Department		Char(35)		NOT NULL, DEFAULT 'Human Resources'
	Phone			Char(12)		Null, 
	Email			VarChar(100)	NOT NULL UNIQUE,
	CONSTRAINT		EMPLOYEE_PK		PRIMARY KEY (EmployeeNumber),
	CONSTRAINT		EMP_DEPART_FK	FOREIGN KEY (Department)
						REFERENCES DEPARTMENT(DepartmentName)
							ON UPDATE CASCADE
);
 
CREATE TABLE PROJECT(
	ProjectID		Int				NOT NULL IDENTITY(1000, 100),
	Name			Char(50)		NOT NULL, 
	Department		Char(35)		NOT NULL, 
	MaxHours		Numeric(8,2)	NOT NULL DEFAULT 100, 
	StartDate		DateTime		NULL,
	EndDate			DateTime		NULL, 
	CONSTRAINT		PROJECT_PK		PRIMARY KEY(ProjectID),
	CONSTRAINT		PROJ_DEPART_FK	FOREIGN KEY(Department)
						REFERENCES DEPARTMENT (DepartmentName)
							ON UPDATE CASCADE
);
 
CREATE TABLE ASSIGNMENT (
	ProjectID		Int				NOT NULL, 
	EmployeeNumber	Int				NOT NULL, 
	HoursWorked		Numeric(6,2)	Null, 
	CONSTRAINT		ASSIGNMENT_PK	PRIMARY KEY (ProjectID, EmployeeNumber), 
	CONSTRAINT		ASSIGN_PROJ_FK	FOREIGN KEY(ProjectID)
						REFERENCES PROJECT (ProjectID)
							ON UPDATE NO ACTION 
							ON DELETE CASCADE, 
	CONSTRAINT		ASSIGN_PROJ_FK	FOREIGN KEY(EmployeeNumber)
						REFERENCES EMPLOYEE (EmployeeID)
							ON UPDATE NO ACTION 
							ON DELETE NO ACTION
); 
------------------------*/
Major Error 0x80040E14, Minor Error 26302
> CREATE TABLE DEPARTMENT(
	DepartmentName	VARCHAR			NOT NULL, 
	BudgetCode		Char(30)		NOT NULL, 
	OfficeNumber	Char(15)		NOT NULL, 
	Phone			Char(12)		NOT NULL,
	CONSTRAINT		DEPARTMENT_PK	PRIMARY KEY (DepartmentName
)
The specified data type is not valid. [ Data type (if known) = VARCHAR ]
ASKER CERTIFIED SOLUTION
Avatar of CCongdon
CCongdonFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers