forgive my ignorance, but could anyone help me how to create a "parent-child" table using nothing but SQL Server Scripts? and be able to enforce Referential Integrity by an "automatic" delete
the problem is that my script below doesn't seem to work...
am i doing something wrong? either technically, or is there a flaw in my understading?
the problem is that my script below doesn't seem to work...
Code:
CREATE TABLE ORGANIZATION (
ORGANIZATION_ID int NOT NULL,
ORGANIZATION_PARENT_ID int NOT NULL,
ORGANIZATION_NAME nvarchar(50) NOT NULL,
ORGANIZATION_LEVEL smallint NOT NULL,
PRIMARY KEY (ORGANIZATION_ID),
FOREIGN KEY (ORGANIZATION_PARENT_ID)
REFERENCES ORGANIZATION (ORGANIZATION_ID)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
go
am i doing something wrong? either technically, or is there a flaw in my understading?