One of our team members recently joined our group in a business analytics course and contest. He explains that he uses the above IF clause to delete and create temporary tables and this is easier for him than others. Can anyone explain what this fetches and how to decide many tables we would need to drop and create using this clause? Here is an example of his query:
IF object_ID('tempdb.dbo.#EricTest') is not null DROP TABLE #EricTest
IF object_ID('tempdb.dbo.#EricTest2') is not null DROP TABLE #EricTest2
SELECT DISTINCT xxxxxxxxxxx
INTO #EricTest
WHERE xxxxx
GROUP BY xxxxx
SELECT xxxxxx
INTO #EricTest2
FROM #EricTest, xxxxxx
GROUP BY xxxxxx
I am just curious how Eric would determine how many temporary views he would create dependent on the ask and any similar methods to this query method. My professor and class was not able to determine a solution or answer and would love some insight and explanation regarding the above query and why it works and what exactly it accomplishes.
Aucun commentaire:
Enregistrer un commentaire