Browse the archive

T-SQL

Blocking with OBJECT_NAME()

Doggos increase blog readership by 140%. 14/10. They are good doggos. As a DBA, you probably use the OBJECT_NAME() function quite a bit. I know I do. If you aren’t familiar with it, you can read the documentation if you want, but it’s a pretty straightforward …

Continue reading

How to create date buckets in T-SQL

I was fiddling around with some data, looking at making a quick aging report. I probably should have reached for Power BI Desktop, but sometimes I can be stubborn, and I wanted to get my T-SQL to work–if nothing else to figure out how to make it work.

Continue reading

Why does ALTER let me DROP?

I was recently chatting with a coworker, discussing why there is no discrete DROP permission for tables, procedures, etc. The conversation actually came from a #SQLHelp question on SQL Slack that was asked along the lines of “What if I want to let a user …

Continue reading

Purging data with batched deletes

This person understands that batching deletes can be helpful. Yesterday, I wrote about the importance of planning your data purges. Today, let's look at the simplest requirement for purging data: Keep data for X days after it's created. There are tons of …

Continue reading

The thrill of purging old data

I get a thrill from roller coasters, but for some people it just makes them purge their lunch. DBAs & Data professionals tend to be digital pack rats. My personal Google Drive is filled with random files that I refused to part with–even though it’s of …

Continue reading

TSQL Tuesday #99: Tabs vs Spaces

It’s T-SQL Tuesday, the blog party that SQL Server expert Adam Machanic (blog|twitter) started. This month’s episode is hosted by Aaron Bertrand (blog | twitter). The topic: Dealer's Choice (Door Number 2: Bad Habits) When I was a kid, Choose Your Own …

Continue reading