Calculate Bitmasks In PowerShell

Have you ever had to calculate bitmasks on the fly?  I have and still do.  In this post, I'm going to show a simple PowerShell script that can be used to generate bitmask values.  But first, let's look at a reason that you may have to use bitmasks. Many of today's servers have a fair number of … Continue reading Calculate Bitmasks In PowerShell

Determining Filegroup for a Table

Have you ever needed to figure out which filegroup your tables are located within?  If you had to do this, you might think it's as easy joining sys.tables to sys.filegroups.  But its a little more complicated than that because tables aren't stored in filegroups. It's The Indexes It's the indexes for a table that determine … Continue reading Determining Filegroup for a Table

Grouping and Rounding Dates

Ever need to group dates and round them to intervals?  I had this exact need for a report on wait stats I was working on for an upcoming post.  I wanted the flexibility to be able to group a list of dates by either minute, hour, date, etc.  And then also round those dates within … Continue reading Grouping and Rounding Dates

Please, no TRIM()?

A couple weeks back I was asked “How come Microsoft has yet to put TRIM() in SQL?” I don’t really know why there isn’t a TRIM() function in SQL Server. There is an LTRIM for function removing leading spaces. And an RTRIM function for removing trailing spaces. But there isn’t a TRIM function. Let’s be … Continue reading Please, no TRIM()?

Checking EXISTS – What’s Your Practice?

Michael Swart (Database Whisperer) posted a great write up and interview with Brad Schulz that is worth checking out.  Michael’s post links to a post from Brad on the use of EXIST and what is required for the SELECT portion of the statement.  Hope you are still with me. Definitely worth the read and +1  … Continue reading Checking EXISTS – What’s Your Practice?

Check out the Ultimate Virtual Conference from SSWUG

In less than a month SSWUG will be hosting the Ultimate Virtual Conference on October 21-24.  This is an excellent opportunity to get the benefits of heading to a conference full of Rock Star speakers while be able to view the content from the comforts of home or your desk. Reasons to Attend Some of … Continue reading Check out the Ultimate Virtual Conference from SSWUG

This Week Only PASSMN Meeting (August 18)

Well… until next month of course.  If you’re in Minnesota and reading this… and don’t mind sharing some snacks with other like minded SQL professional… then come down and join us for this month’s SQL Server user group meeting. We’ll be in a different location for this month – across the skyway from the normal … Continue reading This Week Only PASSMN Meeting (August 18)

Gotta Stop Violating Foreign Keys

About a year ago I was working on a project that required that data be extracted from one database and inserted into an database.  Not the most earth shattering concept.  This is done quite often and doesn’t necessarily require a discussion of foreign keys. So why talk about them… well… in this case the source … Continue reading Gotta Stop Violating Foreign Keys

5 Common Mistakes with Tempdb

One of the things I get to do pretty often is to visit with clients and discuss how they’ve implemented their SQL Server environment.  And if the title of this post is any indication of the contents there are a number of issues that I tend to be able to make recommendations on in all … Continue reading 5 Common Mistakes with Tempdb