General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Indexing a temporary table
I was having trouble getting results from a stored procedure that had a left outer join with a view of the transaction table from Baltimore. I ask one of the programmers what the problem was and he said the transaction table is incredible large and growing larger every second.
He said to get all of the join information from the local table inventory into a temporary table, which I should index. Here is my feeble atempt.
What did I do wrong. What suggestions do you have?
SELECT
i.primary_reference
,i.short_desc
INTO #temp
CREATE INDEX [InInventory]
ON [dbo].[#temp]([primary_reference])
WITH FILLFACTOR = 100 ON [PRIMARY]
FROM inventory i
Here is the original join
vw_SMPaper_Orders_LineItem_Inventory smp with (nolock)
LEFT OUTER JOIN wms_ITRN_all r with (nolock) ON smp.lineitem_primary_reference = r.sku
wms_INTRN_All is the view of the big table.
Thanks
Jim
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only