i am creating user table like code PK Table
CREATE TABLE TblUser (UserId int identity primary key ,Name varchar(20))
AND creating one more table FK Table
CREATE TABLE TblAnnouncements (Id int identity primary key ,Announcements
varchar(20),CreatedBy INT FOREIGN KEY REFERENCES TblUser (USERID) ON DELETE
CASCADE, UpdatedBy INT FOREIGN KEY REFERENCES TblUser (USERID) ON DELETE SET NULL)
i am getting this error
Msg 1785, Level 16, State 0, Line 1
Introducing FOREIGN KEY constraint 'FK__TblAnnoun__Updat__60A75C0F' on table 'TblAnnouncements' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
how to maintain createdby and updatedby in an table....
can you give suggest me any other way to do that ?
thank u.
Aucun commentaire:
Enregistrer un commentaire