| Author |
Topic  |
|
|
rajeshskpm
Starting Member
India
10 Posts |
Posted - 01/30/2009 : 04:50:53
|
suppose a table contains 500 rows. i want to delete 13th,14th,15th rows in a table. how to do this using single query? please reply
rajesh |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 01/30/2009 : 04:52:25
|
If the table contains a identity column or primary key column then
delete from table where primarykeycol in ( 13,14,15) |
 |
|
|
Nageswar9
Aged Yak Warrior
India
600 Posts |
Posted - 01/30/2009 : 04:52:31
|
if u dont have primarycolumn, use row_number() it is easy for u
|
Edited by - Nageswar9 on 01/30/2009 04:53:05 |
 |
|
|
rajeshskpm
Starting Member
India
10 Posts |
Posted - 01/30/2009 : 04:54:53
|
plese write full query
rajesh |
 |
|
|
bklr
Flowing Fount of Yak Knowledge
India
1693 Posts |
Posted - 01/30/2009 : 04:59:57
|
delete s from (select row_number() over( order by id)as rid,* from emp)s where rid in (13,14,15)
|
 |
|
|
Nageswar9
Aged Yak Warrior
India
600 Posts |
Posted - 01/30/2009 : 05:01:17
|
delete table where primarycol in ( 13,14,15)
(or)
delete t from ( select *,row_number() over ( partition fieldname order by fieldname ) as rn from urtable ) t where t.rn in (13,14,15) |
 |
|
| |
Topic  |
|