Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Logical operators in check constraint

rhightower13
Participant
0 Kudos

I'm trying to create a table in the SQL console in the WDW. The SQL is:

CREATE TABLE VISIT (
	patientID	INT , 
	physicianID	INT 	NOT NULL, 
	visitDate	DATE, 
	admissionTime	INT,
	PRIMARY KEY (patientID, visitDate),
	CHECK (patientID <> physicianID),
    CHECK (admissionTime >= 0 AND admissionTime < 24*60)
);

The statement works until I add the last CHECK. When I do I get this error:

11:29:28 AM (SQL Editor) Could not execute 'CREATE TABLE VISIT ( patientID	INT , visitDate	DATE, visitTime	INT, reason	VARCHAR(40), ...'Error: (dberror) 288 - cannot use duplicate table name: VISIT: line 12 col 13 (at pos 1

line 12 refers to the CREATE TABLE line. I've tried removing the other check constraint but I get the same error. It seems to be the CHECK (admissionTime.. constraint that causes the problem.

Any Suggestions?

Ross

  • SAP Managed Tags:
0 REPLIES 0