Click here to Skip to main content
15,908,115 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to do this [^] FASTER! with a change!

SQL
declare @contador integer
select @contador=1
DECLARE @myDocuments db_owner.DocumentsWithAutoIncrementIndexTable
while @contador < 10000
begin
 INSERT INTO @myDocuments VALUES('The quick brown fox jumps over the lazy dog');
 INSERT INTO @myDocuments VALUES('The brown dog walks through the brown forest');
 INSERT INTO @myDocuments VALUES('Little red riding hood looks like a fox in her red dress');
 select @contador= @contador+1
end

DECLARE @myWords db_owner.DocumentsWithAutoIncrementIndexTable
INSERT INTO @myWords(Content) SELECT word FROM dbo.mapper(@myDocuments, ' ') order by word asc

select * from dbo.reducer(@myWords) order by wordcount desc




PLEASE HELP
Posted
Comments
Mehdi Gholam 27-May-15 2:14am    
Do what faster, you are just doing the same thing 10000 times.
Maciej Los 27-May-15 2:18am    
What you mean "FASTER"? What's wrong with this? Be more specific and provide more details (such as time of execution, etc.).
Advay Pandya 27-May-15 2:35am    
Can you please try to avoid looping and insert bulk data ? Because only blocking thing in your query in terms of performance is while loop.
[no name] 27-May-15 2:36am    
i seen your above query i thing you need to be more specific on your point .....please don't get me wrong

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900