Advertisements
How to delete rows in a table are same identical rows in all the fields where clause column. Recently, i got this from one of my friend.
create table tbl_delete (id int, name varchar(30)) insert into tbl_delete values (1,'Muthu') insert into tbl_delete values (1,'Muthu') insert into tbl_delete values (2,'SQL') insert into tbl_delete values (2,'SQL') -- Two rows are same with all fileds select * from tbl_delete WHERE id =1 Begin tran SET ROWCOUNT 1 DELETE FROM tbl_delete WHERE id =1 SET ROWCOUNT 0 -- Run this when you see (1 row(s) affected), otherwise rollback tran Commit tran
Hope this help someone.