December 19, 2005 at 4:27 am
Hello friends
I have two tables like Master_E and Child_E
CREATE TABLE [Master_E] (
[ID] [int] NOT NULL ,
[Name] [varchar] (4) ,
[T_Delete] [varchar] (1) here that check constraint i want to put,
CONSTRAINT [PK_Test_TM] PRIMARY KEY CLUSTERED
(
[ID]
  ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [Child_E] (
[ID] [int] NOT NULL ,
[Name] [varchar] (4) ,
[T_Delete] [varchar] (1)
  GO
insert into Master_E values (1,'SA', null)
insert into Master_E values (2,'GG', null)
insert into Master_E values (3,'GS', null)
insert into Child_E values (1,'SA', null)
insert into Child_E values (2,'GG', null)
Now I want to set flag either yes or no for column T_Delete of Master table.
In master table it is Y if no records found in child table for ID and In master table it is N if records found in child table for ID...but all these things i want from check constraint only..How should i put that check constraint on column T_Delete
for maste table...pls any idea...most welcome
Regards,
Papillon
December 19, 2005 at 9:28 pm
You can't do this with a constraint... you'll need to use a trigger or, maybe, you can also try a "calculated column".
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply