This blog shares my journey as a software engineer, along with personal reviews and life experiences I’ve gained along the way. “I have not failed. I've just found 10,000 ways that won't work.” — Thomas Edison. If you enjoy my content, please support it by clicking on ads (free for you, big help for me!) or by buying me a coffee on Ko-fi. Thank you!
Friday, November 27, 2015
Tuesday, November 17, 2015
SQL Server Queries are spilling out to tempdb
-- How to rid yourself of tempDB spilage if SORT causing issues Create a Temp Table with a CLUSTERED INDEX
IF OBJECT_ID('tempdb..#tempSizes') IS NOT NULL DROP TABLE #tempTable
SELECT DISTINCT
IDENTITY(INT,1,1) AS ID,
Products.Name,
Product_Families.Parent_Family_Name,
INTO #tempTable
FROM Products
LEFT JOIN Product_Families ON Products.Product_Family_ID = Product_Families.Product_Family_ID
WHERE Products.Discontinued = 0
AND Quantity > 0
CREATE CLUSTERED INDEX IX_ID ON #tempSizes(ID)
SELECT * FROM #tempTable
IF OBJECT_ID('tempdb..#tempSizes') IS NOT NULL DROP TABLE #tempTable
SELECT DISTINCT
IDENTITY(INT,1,1) AS ID,
Products.Name,
Product_Families.Parent_Family_Name,
INTO #tempTable
FROM Products
LEFT JOIN Product_Families ON Products.Product_Family_ID = Product_Families.Product_Family_ID
WHERE Products.Discontinued = 0
AND Quantity > 0
CREATE CLUSTERED INDEX IX_ID ON #tempSizes(ID)
SELECT * FROM #tempTable
Thursday, November 12, 2015
Tuesday, November 03, 2015
Subscribe to:
Posts (Atom)