Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rajeshskpm
Starting Member
10 Posts |
Posted - 2009-01-30 : 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 replyrajesh |
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-30 : 04:52:25
|
If the table contains a identity column or primary key column then delete from tablewhere primarykeycol in ( 13,14,15) |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-01-30 : 04:52:31
|
if u dont have primarycolumn,use row_number() it is easy for u |
|
|
rajeshskpm
Starting Member
10 Posts |
Posted - 2009-01-30 : 04:54:53
|
plese write full queryrajesh |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-30 : 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
600 Posts |
Posted - 2009-01-30 : 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 ) twhere t.rn in (13,14,15) |
|
|
|
|
|