Monday, February 7, 2011

how to delete the parent records with out effecting the child records

--parent table
create table test16 (id int primary key,name varchar(10))
insert into test16 values(100,'a')
insert into test16 values(200,'b')
insert into test16 values(300,'c')
insert into test16 values(400,'d')
select * from test16
--child table
---how to delete the parent records with out effecting the child records
create table test17 (id int,address varchar(10), foreign key (id) references test16(id) on
delete cascade)

insert into test17 values(100,'aytw')
insert into test17 values(100,'a')
insert into test17 values(100,'ay')
insert into test17 values(200,'aytw')
insert into test17 values(200,'ayt')
insert into test17 values(300,'ay')
insert into test17 values(300,'ayt')
select * from test17
select * from test16
delete from test16 where id=300

No comments:

Search This Blog

DAX - Grouping on multiple columns and the count

Please go thorugh the below URL for entire soultion. http://community.powerbi.com/t5/Desktop/DAX-Grouping-on-multiple-columns-and-the-cou...