Tally Tables in T-SQL
The Tally (or Numbers) table is one of the most useful constructs in intermediate-level SQL. Have you ever written a...
2014-03-27
56,970 reads
The Tally (or Numbers) table is one of the most useful constructs in intermediate-level SQL. Have you ever written a...
2014-03-27
56,970 reads
In today’s blog I will attempt to challenge the popularly held notion that LIKE “%string%” wildcard searches must be slow...
2014-03-26
20,698 reads
In SQL Server 2005, Microsoft introduced the Common Table Expression (CTE). CTEs share similarities with VIEWS and derived tables, but...
2014-03-23
1,614 reads
If you learn one new T-SQL (i.e., Microsoft SQL Server) concept today it should be ROW_NUMBER(). Introduced in SQL 2005,...
2014-03-22
2,972 reads
When you've got only a single effective date on a record and you need to artificially create the effective end date based on a following row in T-SQL, the techniques discussed in this article will help you decide what is best.
2014-03-18
33,873 reads
Follow along as this starter article on the SQL TABLE Type walks you through the various ways it can be used in T-SQL.
2014-03-03
10,482 reads
2014-01-09
2,345 reads
A way to assign variable and overrideable defaults to input parameters to an SP or FUNCTION using a configurations table.
2013-09-03
8,386 reads
2013-09-03
2,458 reads
The SQL MERGE statement can make your DML querying more efficient but you need to take care or you may get burned
2013-04-03
24,661 reads
Disclaimer: The following is built with Claude Code. Just need to justify my $100/mo...
By Brian Kelley
I developed these rules a while back, before COVID. I had a period of...
By Steve Jones
Someone asked why I would use TRY_PARSE after I posted a question at SQL...
I have a table that ends in ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]. I'm about to...
Comments posted to this topic are about the item OUTER APPLY Fundamentals: Part 2
Comments posted to this topic are about the item Building Great Software
I have this data in the OrderHeader table in a SQL Server 2025 database (ordered by CustomerID ASC):
orderid orderdate customerid complete 3 2025-05-10 00:00:00.0002 1 21 2024-01-10 00:00:00.0003 1 15 2023-10-28 00:00:00.0004 1 13 2025-03-08 00:00:00.0006 1 11 2024-04-02 00:00:00.0007 1If I run this query, how many rows are returned?
SELECT * from dbo.OrderHeader where customerid between 3 and '6'See possible answers