Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Regarding the indexes on Tables

$
0
0

Hi, I am using two tables which has 5 millions of records in them, now i am trying to get the data from those tables to temp tables. I have added Non clustered indexes on them, but still the execution plan shows as table scan for that particular tables. One more important thing is all the columns in the tables have duplicate values, so there is no clustered indexes on them. So how can I get the clustered index for these tables. 

The tables I am using are 

select distinct a.TIN as Prov_TIN
Into #sqs_objector_TINs
from pact.dbo.sqs_provider_tracking a
where a.[Objector?] in ('Top Objector','Objector','Rejector')

--NOTE: I have Prov_TIN as Non clustered index on this table.

-------------------------------------------------------------------------------------------------

SELECT z.SYSTEMNAME
,Z.PROV_TAX_ID
,z.PROVIDERNAME
,z.STATECODE
,z.SRC_PAR_CD
,z.SEQUEST_AMT
,case when Z.LCLM_RSTMT_TREND_CAT_CD IN ('HI','HO') Then 'H' else 'P' end as Hosp_Ind
,Z.SMG_ID
INTO  #SQS_EDW_SOURCE_WithSMG 
FROM PACT.dbo.SQS_EDW_SOURCE_WithSMG z
WHERE YEAR(Z.Incurred_Mth)=2013

--NOTE: I have Prov_tax_ID, Sequest_AMT, Smg_id as non clustered indexes on this table.

Please Let me know what is the best solution I can get for this.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>