Custom Sequence Numbering
This article shows how to implement low cost custom sequence numbering logic via a cunning use of the the ROW_NUMBER() function
2013-06-14 (first published: 2011-02-07)
20,098 reads
This article shows how to implement low cost custom sequence numbering logic via a cunning use of the the ROW_NUMBER() function
2013-06-14 (first published: 2011-02-07)
20,098 reads
2011-01-28
2,885 reads
When Fabiano agreed to undertake the epic task of describing each showplan operator, none of us quite predicted the interesting ways that the series helps to understand how the query optimizer works. With the Merge Interval, Fabiano comes up with some insights about the way that the Query optimizer handles overlapping ranges efficiently.
2011-01-28
3,071 reads
SQL Server MVP Jeff Moden shows us a quick and dirty bit of SQL Spackle to display the content of VARCHAR(MAX) and NVARCHAR(MAX).
2024-10-04 (first published: 2011-01-27)
24,236 reads
2011-02-18 (first published: 2011-01-25)
3,043 reads
The BIT data type is an awkward fit for a SQL database. It doesn't have just two values, and it can do unexpected things in expressions. What is worse, it is a flag rather than a predicate, and so its overuse, along with bit masks, is a prime candidate for being listed as a 'SQL Code Smell'. Joe Celko makes the case.
2011-01-24
3,676 reads
2011-01-21
3,882 reads
2011-01-13
3,870 reads
2011-01-28 (first published: 2011-01-11)
1,784 reads
It is always more efficient to maintain referential integrity by using constraints rather than triggers. Sometimes it isn't obvious how to do this. Until a recent idea by Alex Kuznetsov, the history table presented problems for checking data that were difficult to solve with constraints. Joe Celko explains.
2011-01-11
3,294 reads
By Steve Jones
Fear is fueled by a lack of imagination. The antidote to fear is not...
The slidedeck and the SQL scripts for the session Indexing for Dummies can be...
By Chris Yates
Change is not a disruption in technology; it is the rhythm. New frameworks appear,...
Comments posted to this topic are about the item Building AI Governance and Policies-...
Why is sql doing a full scan VS seeking on the index? I've included...
We have a report that has multiple tables that list the top 15 performers...
The DBCC CHECKIDENT command is used when working with identity values. I have a table with 10 rows in it that looks like this:
TravelLogID CityID StartDate EndDate 1 1 2025-01-11 2025-01-16 2 2 2025-01-11 2025-01-16 3 3 2025-01-11 2025-01-16 4 4 2025-01-11 2025-01-16 5 5 2025-01-11 2025-01-16 6 6 2025-01-11 2025-01-16 7 7 2025-01-11 2025-01-16 8 8 2025-01-11 2025-01-16 9 9 2025-01-11 2025-01-16 10 10 2025-01-11 2025-01-16The docs for DBCC CHECKIDENT say this if I run with only the table parameter: "If the current identity value for a table is less than the maximum identity value stored in the identity column, it is reset using the maximum value in the identity column. " I run this code:
DELETE dbo.TravelLog WHERE TravelLogID >= 9 GO DBCC CHECKIDENT(TravelLog, RESEED) GO INSERT dbo.TravelLog ( CityID, StartDate, EndDate ) VALUES (4, '2025-09-14', '2025-09-17') GOWhat is the identity value for the new row inserted by the insert statement above? See possible answers