Need query for insert record middle of the table

Posted by Mokkarasu under Sql Server on 7/14/2012 | Points: 10 | Views : 1572 | Status : [Member] | Replies : 3
I Need query for insert record middle of the table ....




Responses

Posted by: Sgtammana on: 7/14/2012 [Member] Starter | Points: 25

Up
0
Down
can you elaborate the question..
it means that you have to insert the data in a datatable or in the SQL tables.

Mokkarasu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mokkarasu on: 7/14/2012 [Member] Starter | Points: 25

Up
0
Down
Query need to insert record middle of the sql table...

for Example if my table has 20 records.if i insert one record means it will store as 21 st record..Instead of this my record should be stored as a 11 Th record
of that table...i need query for this


Mokkarasu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pandians on: 7/15/2012 [Member] [MVP] Silver | Points: 25

Up
0
Down
You can do that if the following is the scenario...
Create Table Table1

(
Id Int Not Null Primary Key,
Column1 Varchar(100)
)
Go

Insert Table1 Values(2,'aaa')
Go
Insert Table1 Values(3,'bbb')
Go
Insert Table1 Values(1,'ccc')
Go
Insert Table1 Values(20,'ddd')
Go
Insert Table1 Values(11,'eee')
Go

Select * from Table1
Go
Record will be sorted based on Clustered Index column(Id). We have inserted the data like
2
3
1
20
11

But, the actual data in table will be like
1
2
3
11
20


Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Mokkarasu, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response