December 9, 2008 at 11:33 pm
*** i have a 400000 lacs data. i want to this data separeted to 40 tables. per table have 100000 data. so i make a one table data_distribution and the field are table_name, start & end.
ex.my first table name is new_ads_1 & the start is 1 & end is 100000 similarly next table is new_ads_2 & the start is 100001 & end is 200000
continue to 40 table..
how i will write stored procedue??????
CREATE procedure tabledistribution
@Start int=1,
@End int=100000
as
set nocount on
create table #temptb
(
Table_name varchar(50),
Start int,
End int
)
insert into #temptb(table_name, start, end) values (new_ads_1, 1, 100000)
if exit inserttable_distribution with new_ads_1
drop new_ads_1
create table #temptb1 with new_ads_2
(
table_name varchar(50),
start int,
end int
)
insert into #temptb1(table_name, start, end) values (new_ads_2, 1000001, 200000)
set start int identity seed ( 1, 100000)
insert into ads(ad_category,title,brief,large,image_url,seller_id,source,source_id,details_from_source,dated,city_id,source_date,entered_by) values (@ad_category,@title,@brief,@large,@image_url,@seller_id,@source,@source_id,@details_from_source,@dated,@city_id,@source_date,@entered_by)
for ad_id <= 100000
next row
GO
December 10, 2008 at 12:18 am
ganesha2181 (12/9/2008)
*** i have a 400000 lacs data. i want to this data separeted to 40 tables. per table have 100000 data.
Why?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 10, 2008 at 5:16 am
Thats the first question came to my mind that why do u need to split it in 40 tables? u better right 4 million record instead 40 lacs record. some ppl might not understand lacs.
December 11, 2008 at 7:06 am
lacs is not a computer term (nor even a dairy term :))
I believe the poster meant to say lakhs, a word in Hindi meaning a large number
I had an unattributed posting from Wikopedia earlier when another poster used that term
por favor (please in Spanish)
no foreign terms unless defined
some of us are (sadly) monolingual and that language is American English
December 11, 2008 at 8:08 am
Lakh: 10 exp 5 (100, 000).
In India, there is:
[font="Courier New"]
. thousand (10 exp 3),
. lakh -- 100 thousands (10 exp 5)
. crore -- 10 millions (10 exp 7)
. arab -- 1 billion (10 exp 9).[/font]
Indians are so used to their system, sometimes it is easy to forget that it is not generally understood by others...
December 11, 2008 at 9:39 am
Seggerman (12/11/2008)
some of us are (sadly) monolingual and that language is American English
And even those who are not monolingual (British English and Afrikaans) may not understand the terms.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 11, 2008 at 9:54 am
As you did post this in a SQL Server 2005 forum, I am assuming you are using SQL Server 2005. If you are using Enterprise Edition, I'd suggest reading up on partitioned tables in Books Online (BOL) instead of creating 40 separate tables and see if that meets your needs.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply