Possible Infinite Recompile Was Detected for SQLHANDLE

On one of my SQL Server instances, I see a lot of these infinite recompile messages in the SQL log. Sounds bad, but they never lined up with any detected errors or failures, and I always seemed to have more important things to focus on so I let it slide. Well, today was a slow day — being the Friday before a holiday weekend — so I decided to investigate. The error messages, error #2814, all look like the below:
read more

Return Max or Min Value of a Group of Columns as a Single Column

Recently, I needed a query to identify tables that developers had create as point-in-time backups of tables that were never used again (turns out, there’s quite a lot of them in this database). They are characterized by having _bak or _ appended to the end of them. I wanted to provide a list of the tables to the development team and give them the opportunity to say that any of the tables should not be deleted. I wanted to provide,
read more

What is the max/min size of a decimal data type?

Recently, I wrote a maintenance script to check every table in every database on our servers at work nightly and email a report of identity columns that are approaching the limits of their data type. The minimum and maximum values for most numerical data types are documented in Books online, but for decimal/numeric data types it is not documented and varies based on the values provided for the precision and scale. Most people know that precision is the total number
read more

T-SQL Tuesday #74: Be the Change Round-up

Thanks to everybody that participated in this month’s T-SQL Tuesday. A big thanks to everyone who wrote a participating blog post, and a really huge thanks to everyone who read the posts shared by this month’s participants. If you follow one of the links on this round-up page, I will kindly ask that you leave a comment on a blog post that you read if it teaches you something, gives you a new perspective, or makes you think. A blog
read more

T-SQL Tuesday #74: Ch-ch-changes

Welcome to my contribution for T-SQL Tuesday 74 being hosted by me. So special thanks to me for hosting it. Good job me, I’ll buy me a beer next time I see me to thank me properly. But enough about me, my post is about using Query Store in SQL Server 2016 to identify queries or plans that have changed. Visit the blog party page to take part in this month’s T-SQL Tuesday event or to read other blog posts
read more

T-SQL Tuesday #73: Never Made That Mistake Again

T-SQL Tuesday is a monthly community-wide blogging event created by Adam Machanic (blog|@AdamMachanic), and everyone is invited to particpate. This month’s blog post party — I like that phrase, it has a nice ring to it — is being hosted by Bradley Ball (blog|@SQLBalls), and the holiday-themed topic this month is T-SQL Tuesday #73: Naughty or Nice?. For my part, I want to relate a cautionary tale about how I crashed a production server at Microsoft at 3 o’clock in
read more

New Whitepaper: Deciding Between Merge and Peer-to-Peer Replication

Replication is still a major component of SQL Server today even with Availability Groups as an alternative to certain scenarios. Availability Groups does not allow you to have more than one writeable version of the data at any given time. Replication is the only native component or feature in SQL Server that will allow you to have multiple writeable databases that maintain data in sync to any near-real-time degree. Once you have determined that you need a solution that provides
read more

Oklahoma City User Group Presentation Files

Earlier this week, I got the opportunity to present online for the Oklahoma City SQL Server User Group on SQL Server Mythconceptions and Mythteries. The files from my presentation are attached below for download. The zip file contains my slide deck and demo code from the session. SQLServerMythconceptionsAndMythteries.zip (653 KB)
read more

Error Creating Remote Distributor When Creating a Local Distributor

Recently, I was working on a Peer-to-peer replication automation project. When I switched from my local test servers to some lab servers to test my scripts, I ran into some issues. The thing that confused me at first was that it was complaining about a missing remote login for the replication linked server that gets created when you run sp_adddistributor. The reason the error was confusing at first is because I was creating local distributors (the best practice for peer-to-peer
read more

T-SQL Tuesday #65 – Overcoming Variable Limitations in SQLCmd Mode

It’s time again for that T-SQL blog party T-SQL Tuesday, and this month’s host is Mike Donnelly (blog|@SQLMD). If you want to join in the blog party, take a look at Mike’s announcement for an explanation of the topic and rules for participating: T-SQL Tuesday #065 – Teach Something New. My contribution this week is about overcoming the variable limitations of SQLCmd mode. Most people know what SQLCmd is, the command line SQL client utility for running T-SQL, or perhaps
read more