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
 Relational database error

Author  Topic 

Mohamed Faisal
Yak Posting Veteran

51 Posts

Posted - 2012-09-23 : 07:35:08
Hi There,

I have a problem when i add the Relational Database i getting an error and not sure what it is. Msg 102, Level 15, State 1, Line 33
Incorrect syntax near '.'.

below will be the tables i created:

CREATE TABLE ClientTable
(
clientID char(5) NOT NULL,
clientName Char(30) NOT NULL,
clientAddress char(50) NOT NULL,
clientContact Numeric(8) NOT NULL,
CONSTRAINT ClientTablePK PRIMARY KEY(clientID),
CHECK(clientID like '[A-Z][0-9][0-9][0-9][A-Z]'),
CHECK (clientContact like '[6][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' OR
clientContact like'[0-9][0-9][0-9][0-9][0-9][0-9][0-9]' OR
clientContact like'[9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]')
);

CREATE TABLE CaseTable
(
referenceNum int NOT NULL IDENTITY(100000,1),
startDate DATETIME NOT NULL,
endDate DATETIME NULL,
caseDetail Char(255) NOT NULL,
caseType Char NOT NULL DEFAULT'copyright and trademark',
clientID Char(5) NOT NULL,
CONSTRAINT CaseTablePK PRIMARY KEY(referenceNum),
CONSTRAINT ClientTableFK FOREIGN KEY(clientID)
REFERENCES ClientTable(clientID),
CONSTRAINT referenceValues CHECK(referenceNum like 'intellectual property enforcement, copyright and trademark, patent and industrial design, trade secret, risk management' OR
referenceNum like'litigation'),
CONSTRAINT clientIDValues CHECK(clientID like '[A-Z][0-9][0-9][0-9][A-Z]')
);

CREATE TABLE ServiceTable
(
serviceCode Char(3) NOT NULL,
serviceDescription Char(255) NOT NULL.
minCharge numeric NOT NULL,
CONSTRAINT ServiceTablePK PRIMARY KEY(serviceCode),
CONSTRAINT serviceCodeValues CHECK(serviceCode like '[C][0-9][0-9]' OR
serviceCode like'[E][0-9][0-9]' OR
serviceCode like'[O][0-9][0-9]'),
CONSTRAINT minChargeValues CHECK(minCharge BETWEEN '500' AND '1000000')
);

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-09-23 : 08:08:22
It's typo in the last table creation - see below. In the output window, if you double-click on the error message, it will take your cursor to the line where the error is occurring.
....
CREATE TABLE ServiceTable
(
serviceCode Char(3) NOT NULL,
serviceDescription Char(255) NOT NULL. --<< Change the . to a comma
minCharge numeric NOT NULL,
....
Go to Top of Page

Mohamed Faisal
Yak Posting Veteran

51 Posts

Posted - 2012-09-23 : 11:36:29
Thanks Allot.
Go to Top of Page
   

- Advertisement -