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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Problem in insert records

Author  Topic 

devisetti
Starting Member

30 Posts

Posted - 2008-04-03 : 09:30:53
Guys

I have got a table with 42 lakh records.

I am trying to insert into the target table by using select
and using like keyword. It is inserting records randomly. But need to insert records in sequence which should be ordered by. The problem here Iam not able to use order by because of 42 lakh records. Any possible solution for this is appreciated.

Following is the example.
-------
insert into target table
select * from test_policy
where policynumb like '[cdklnqtswxyabeghjmpr1z]%'

this statment is used in the stored procedure

these records should be sorted out while insertion. But it is inserting randomly.

thanks in advance





harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-03 : 09:34:20
Which column decides order of insertion?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

pravin14u
Posting Yak Master

246 Posts

Posted - 2008-04-03 : 09:37:42
Even if you insert in some order, the data would be stored in a random order in the destination table (test_policy ). So using Order by in your select query will not do any wonders.

Can you tell why you need the data to be inserted in Order?

Prakash.P
The secret to creativity is knowing how to hide your sources!
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-04-03 : 09:42:15
and what's lakh?

Em
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-03 : 09:44:13
1 Order of the data in a table doesnt matter. It should be ordered during selection
2 Lakh is Indian method of expressing 100,000

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-03 : 09:44:38
quote:
Originally posted by elancaster

and what's lakh?

Em



In Indian context, 1 Lakh = 100K

So basically OP means 4.2 million records.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-04-03 : 09:48:37
i feel un-worldly-wise

but i do know what daps are, and frequently run up our snicket in them

Em
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2008-04-03 : 11:55:06
elancaster - OK I'll bite..what are daps? And what is a snicket? Your comment sounds painful: frequently run up our snicket in them - ouch!!!

Terry
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-04-03 : 13:59:41
lol

daps are pumps / plimsoles... limited to round southwest of the UK
a snicket is a footpath, specifically through housing estates... limited to round yorkshire i guess (north England)

Em
Go to Top of Page
   

- Advertisement -