473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Regarding Index Rebuilding

Greetings,
While loading data into Sql Server using BCP utility,
we have to explicitly need to drop the indexes. then after loading the
data we recreate them. I just want to know if this is possible through
some other ways. i mean in DB2 we have an option of index rebuild
option which takes care of this job.
Do we have anything as such in BCP or is there some other way?

Any help will be appreciated

TIA

Dec 7 '05 #1
7 3207
SQL Server has also a rebuildindex option, but in your case probably
somenone has decided to drop the index in order to speed up the
inserts. Ans once dropped you can't rebuild the index you have to
re-create.
In SQL2005 you have the option to disable non-clustered indexes during
bcp actions, but in 2000 you can't.

Markus

Dec 7 '05 #2
can i get some link for SQL2005 bcp utility????

Dec 7 '05 #3
(pa***************@yahoo.co.in) writes:
can i get some link for SQL2005 bcp utility????


There are not much differences between BCP in SQL 2000 and SQL 2005. The
ALTER INDEX command that Markus mentioned is part of SQL 2005. Just using
BCP from SQL 2005 is not changing anything.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 7 '05 #4
Thanx for the reply. One thing, i went through the docs of bcp utility
i didnt find any option for rebuilding the index.
Can you tell me the exact way of using it in bcp utility?

TIA

Dec 8 '05 #5
(pa***************@yahoo.co.in) writes:
Thanx for the reply. One thing, i went through the docs of bcp utility
i didnt find any option for rebuilding the index.
Can you tell me the exact way of using it in bcp utility?


BCP does not have any feature to rebuild indexes. You create the indexes
with the regular T-SQL commands.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 8 '05 #6
Thanks.

Dec 8 '05 #7

"Erland Sommarskog" <es****@sommarskog.se> wrote in message
news:Xn**********************@127.0.0.1...
(pa***************@yahoo.co.in) writes:
Thanx for the reply. One thing, i went through the docs of bcp utility
i didnt find any option for rebuilding the index.
Can you tell me the exact way of using it in bcp utility?
BCP does not have any feature to rebuild indexes. You create the indexes
with the regular T-SQL commands.


I have to do something like this quarterly.

The part I haven't bothered to automate yet is the script used to create the
indexes.

(That and dropping them... someday I'll script these parts.)

However, the rest is.

Basically I have a CMD file that I run at the OS level that truncate tables
in question.

Then it BCP's the data in and the calls OSQL to run scripts on the tables in
question to rebuild the indexes.

Basically it takes me about 1/2 hour of prep work (script out indexes incase
they've changed since last quarter), drop them, and then run the batch file
and walk away.


--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Dec 9 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: xo55ox | last post by:
Hi, I want to find out what is a good way to identify indexes that need rebuilding. I tried to run DBCC showcontig and identify them based on the scan density %. And according to a Microsoft...
8
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is...
3
by: Bari Allen via AccessMonster.com | last post by:
I have a database in a Front-End/Back-End User Environment, which has been running fine, for 4 years. Lately, when the users try to enter data (from a form into a single table) they've been...
2
by: B-Dog | last post by:
Any idea why when I try to fill my dataset using xContacts.Fill(xds.Contacts) I get the error: : Index was outside the bounds of the array. I've tried rebuilding my dataadapters and dataset...
2
by: Peter Lindquist | last post by:
I had a fun issue this morning, and now I'm wondering if I violated a rule I didn't know about. Any insight would be much appreciated. All operations involving this particular table may be assumed...
10
by: wackyphill | last post by:
After rebuilding an index, it still shows as the same amount of fragmentation. ANy ideas what's wrong? I'm determining which indexes to rebuild using the following query: SELECT...
5
by: vj_dba | last post by:
Hi group, I have a table say with 10000 records and 10 columns initially, I created an index say i1, after few days I altered the table by adding 10 new columns and 90000 rows of records summing...
8
by: rcamarda | last post by:
I thought I would delve into index fragmentation and I found some great sql from many posters (thanks Erland!). My question is how bad is bad? I know this is very subjective. Some scripts I found...
1
by: trd79 | last post by:
Hi, I am extracting data from an operational system in order to maintain a mirror that can be used for reporting. I have two means of filling this database: 1) A stored procedure which...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.