T-SQL Programming Aaron Bertrand in T-SQL Programming Strategies for queries against bit columns Recently someone posted a question where they couldn’t quite figure out how to construct a predicate based on a bit parameter. They tried to write... 20 November 2023 7 min read
T-SQL Programming Aaron Bertrand in T-SQL Programming Don’t use DISTINCT as a “join-fixer” I’ve quietly resolved performance issues by re-writing slow queries to avoid DISTINCT. Often, the DISTINCT is there only to serve as a “join-fixer,” and I... 16 October 2023 6 min read
T-SQL Programming Aaron Bertrand in T-SQL Programming Working around schema drift in SQL Server At Stack Overflow, our environment has multiple implementations of a largely – but not 100% – identical schema. (By “schema,” I mostly mean the set... 14 August 2023 10 min read
Blogs Louis Davidson in Blogs Generating Repeatable Sets Of Test Rows In order to test graph structures, I needed a large set of random data. In some ways, this data will resemble the IMDB database I... 30 September 2022 11 min read
Blogs Louis Davidson in Blogs SQL Server Graph Tables – Cross Database Surprises Louis Davidson explains how to get around an interesting issue when doing cross-database queries involving graph database tables.… 21 March 2022 3 min read
SQL Books Greg Larsen in SQL Books Transact-SQL: The Building Blocks to SQL Server Programming by Gregory A. Larsen Transact SQL (TSQL) is the languaged used to query and update data stored in a SQL Server. This book, written by Simple Talk author Greg... 20 July 2020 2 min read
Blogs Louis Davidson in Blogs Discovering Three or Four Part Names in SQL Server Database Code I am in the middle of a project to enable our corporate databases to work with continuous integration using RedGate SQL Automation (and hopefully get... 08 March 2019 6 min read
Blogs Louis Davidson in Blogs Technique and Simple Utility to Determine the Datatype of a Scalar T-SQL Expression Note: post revised to take into consideration tips from comments The other day, I was working with a query where someone had put together an... 11 December 2018 6 min read
Blogs Louis Davidson in Blogs I Have an Exclusive Lock, My Row Is Safe, Right? Note: This is an update of a blog I posted in 2006 with a lot of additional information (I was less wordy in my 30s... 06 December 2018 7 min read
Blogs Phil Factor in Blogs Spoofing Data Convincingly: Doing the Shuffle and Zip Having spent a lot of my working life trying to preserve the integrity of data, there was a certain intriguing novelty in the idea of... 13 August 2018 6 min read
Blogs Phil Factor in Blogs Spoofing Data Convincingly: Credit Cards I haven’t seen a SQL Server table with real unencrypted credit card numbers for several years, and I don’t know of any good reasons to... 08 August 2018 8 min read
Blogs Louis Davidson in Blogs T-SQL Tuesday #104: Code You Would Hate To Live Without (Relative Positioning in Date Table) Today’s blog post is in response to Bert Wagner’s invitation here: https://bertwagner.com/2018/07/03/code-youd-hate-to-live-without-t-sql-tuesday-104-invitation/. For me, the answer was pretty simple. There is one piece of code that... 09 July 2018 9 min read
Blogs Louis Davidson in Blogs Row-wise system function calls, always the same? Assumptions are generally terrible things for programmers (and likely my next “What Counts” blog goes there), because what looks to be true when trying things... 20 June 2018 6 min read
Blogs Louis Davidson in Blogs Why Design and Test Your Utility Code for Publishing? As the saying goes: do to others as you would have them do to you. When writing code, I would suggest a complimentary saying of... 31 May 2018 6 min read
Blogs Louis Davidson in Blogs SQL Server Database Security and Source Control Maintaining database security can be a complex task. In this post, Louis Davidson describes a method that can be used to maintain separate security for... 17 May 2018 7 min read
Blogs Louis Davidson in Blogs Operator Precedence versus the Confusing Constraint Translation The other day, a person I work with was creating some fairly complex CHECK constraints to protect data in a new table that was being... 30 April 2018 6 min read
Blogs Louis Davidson in Blogs Finding overlapping ranges of data This week, I had a problem where I needed to find and eliminate from the results of my query, data with overlapping ranges. I have... 18 April 2018 15 min read
Blogs Louis Davidson in Blogs Using SQLCMD, End Execution of SQL Commands in a File This week’s blog is a just about a few simple SQLCMD mode tricks for SSMS, but these tricks have saved me a lot of heartache... 09 April 2018 6 min read
Blogs Louis Davidson in Blogs Just What Exactly Will Cast to a Bit Value? I am working through my OneNote folder of blog ideas, and this one, while being one of the least consequential of them, was the most... 02 April 2018 4 min read
Blogs Louis Davidson in Blogs Securing access to data for admin and dbo In this blog, I want to explore what you can do to block the owner of a database from doing stuff in the database they... 19 March 2018 11 min read