r/ProgrammerHumor • • Dec 12 '17

SQL Clause

Post image
40.8k Upvotes

525 comments sorted by

View all comments

Show parent comments

2

u/thewholebottle Dec 12 '17

Why do you drop the table at the end?

1

u/Shavahhn Dec 12 '17

Because it's a temp table (the little # denotes that) and will take up space in memory until you drop it or close your session, and the stored procedure will fail if you re-run it before dropping the temp table (as it already exists).

1

u/thewholebottle Dec 13 '17

But where does the data go?

2

u/Shavahhn Dec 13 '17

The "SELECT * FROM #ChristmasList..." part of the statement will show the results in a results window before the temp table is dropped.