Home > Archive > SQL server exams > May 2002 > Another Syntax Error





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Another Syntax Error
cocolocopolo

2002-05-12, 2:51 am

For practice purpose, I created Database 'BookShopDB'. Under that,
I tried to create a Table 'tblEmployees'.

So, from Query Analyzer, I typed as follows:


Use BookShopDB
Go

Create Table tblEmployees
(EmployeeID SmallInt Identity not null,
FirstName varchar(30) not null,
LastName varchar(30) not null,
Address1 varchar(60) not null,
Address2 varchar(60) not null, Default 'N/A',
City varchar(15) not null,
State char(2) not null,
Zip varchar(12) not null,
Phone varchar(24) not null,
DOB Datetime not null,
HireDate Datetime not null,
PositionID TinyInt not null)

Go


But, unfortunately, I got error:

Server: Msg 142, Level 15, State 2, Line 7
Incorrect syntax for definition of the 'TABLE' constraint.

Where is "Line 7" ??? Where is incorrect syntax ???

Thanks in advance for any advice.
hard_coder

2002-05-12, 9:16 am

--> Address2 varchar(60) not null, Default 'N/A',

after the "not null" there should NOT be a comma. The line should read:

Address2 varchar(60) NOT NULL DEFAULT 'N/A',

if you have the BOL (Books Online) Help for SQL Server, or go to msdn.microsoft.com, check out the section on creating tables with T-SQL. Keywords: CREATE TABLE, NOT NULL, DEFAULT
cocolocopolo

2002-05-13, 2:49 am

Thanks hard_coder.

I will also try msdn.microsoft.com

Thanks again.
Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net