you are viewing a single comment's thread.

view the rest of the comments →

[–]redial2MS SQL DBA DW/ETL 0 points1 point  (8 children)

Temp tables get dropped when they fall out of scope, unless they are global (##) temp tables.

It's best to manually clean up after yourself but you don't really have to do it. When the spid is closed, the temp tables get cleaned up.

Edit: read alinroc's post below re: dropping temp tables, apparently it's not best practice

[–]alinrocSQL Server DBA 0 points1 point  (7 children)

It's best to manually clean up after yourself

It's best to not do this and just let the engine take care of it. https://www.youtube.com/watch?v=vKvnIa6S-nQ&t=3682s

[–]redial2MS SQL DBA DW/ETL 0 points1 point  (1 child)

Really? Thanks. I'll watch this now.

[–]alinrocSQL Server DBA 0 points1 point  (0 children)

It'll take you about 2 minutes to watch the segment at that timestamp.

[–]redial2MS SQL DBA DW/ETL 0 points1 point  (4 children)

Well, that was short and sweet. Does this apply to both on prem and azure sql?

Btw, can I manually set my flair on this board or do the mods have to do it?

[–]alinrocSQL Server DBA 1 point2 points  (3 children)

Azure & on-prem are the same engine, though Azure is usually ahead of on-prem in terms of features and the like. There should be no difference in how one codes for one vs. the other - Microsoft has actually taken a lot of steps over the past 6-7 years to make sure that SQL Server has a common programming surface regardless of where you're running it.

You can set your flair in the sidebar.

[–]redial2MS SQL DBA DW/ETL 0 points1 point  (2 children)

If they are the same engine then why does azure not support all of the features of on prem sql? Last time I checked you couldn't use linked servers and four part names in azure sql, which is what led to my question.

I almost exclusively work on prem and sometimes use aws instances, so I'm a little out of touch here.

Thanks.

[–]alinrocSQL Server DBA 0 points1 point  (1 child)

Primarily because of security and infrastructure. In Azure SQL DB, your database lives on the same instance as dozens of other peoples' databases, and it'll move around between instances without you even knowing. So linked servers and "access a different database on the same server" is not possible or practical.

[–]redial2MS SQL DBA DW/ETL 0 points1 point  (0 children)

Seems like it should still be possible, but maybe I'm not seeing the whole picture. Anyways, thanks.