How do I specify constraint on my field that allows null but if value exists it should be one of values of primary key within existing table? Take a look at the code:
CREATE TABLE TestTable ( RowId int IDENTITY NOT NULL PRIMARY KEY, RowParentId int NULL, -- < how do I specify constraint that RowParentId if not NULL should be RowId (foreign key to existing table?) RowName nvarchar(30), RowShortName nvarchar(10) ) GO
I want to be able to generate parent child view without limiting depth and enforcing constraint on existing parent.
Hope I was able to convey what I’m looking for.
Cheers
Isn’t that just a foreign key?
if it is not null, then it must be a value from the parent table.