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.
Author |
Topic |
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2014-01-30 : 19:04:30
|
I am running this query but getting error.1. Disabling the Clustered Index 2.Do the insert bulk3.Rebuild the index TRUNCATE TABLE Temp_MissingOLSMachine -- CREATE TABLE Temp_MissingOLSMachine( -- EntitlementID NVARCHAR(128) COLLATE Latin1_General_CS_AS --) --CREATE CLUSTERED INDEX CIX_MissingOLSMachine_EntitlementID -- ON Temp_MissingOLSMachine(EntitlementID) ALTER INDEX [CIX_MissingOLSMachine_EntitlementID] ON Temp_MissingOLSMachine DISABLE GO INSERT INTO Temp_MissingOLSMachine SELECT EntitlementID FROM DML.ExceptionsTrackingTable WHERE ExceptionType = N'No OLS Machine Data' select * from Temp_MissingOLSMachine ALTER INDEX [CIX_MissingOLSMachine_EntitlementID] ON Temp_MissingOLSMachine REBUILDGOBut i am getting an error of Msg 8655, Level 16, State 1, Line 1The query processor is unable to produce a plan because the index 'CIX_MissingOLSMachine_EntitlementID' on table or view 'Temp_MissingOLSMachine' is disabled.Please help.Thanks,Gangadhara MSSQL Developer and DBA |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-01-31 : 08:32:48
|
Before Index Rebuild you want to enable the Index firstJaveed Ahmed |
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2014-01-31 : 12:15:02
|
But enabling means that i need to do the rebuild only right.ALTER INDEX [CIX_MissingOLSMachine_EntitlementID] ON Temp_MissingOLSMachine DISABLEGO INSERT INTO Temp_MissingOLSMachineSELECT EntitlementID FROM DML.ExceptionsTrackingTableWHERE ExceptionType = N'No OLS Machine Data'ALTER INDEX [CIX_MissingOLSMachine_EntitlementID] ON Temp_MissingOLSMachine REBUILDselect * from Temp_MissingOLSMachine GOCould you please post the snippet of the query to enable the Clustred Index.Thanks,Gangadhara |
|
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-02-03 : 07:09:47
|
try this ALTER INDEX ALL ON Temp_MissingOLSMachineJaveed Ahmed |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2014-02-04 : 14:59:13
|
You cannot disable the clustered index - since that IS the table. Disabling it will prevent all access to the table - insert/delete/update/select...What you want to do is disable all NC indexes, perform your bulk insert, then rebuild all indexes (including the clustered index). To rebuild all indexes you issue this statement:ALTER INDEX ALL ON Temp_MissingOLSMachine REBUILD;If you drop the clustered index, then you would have to recreate it after the load - and adding a clustered index to a table will force a rebuild of all NC indexes for both the drop and the create. |
|
|
|
|
|