Generating number sequences with Common Table Expressions
The script shows one of ways generating number sequence - this one uses CTE.
2011-10-04 (first published: 2008-02-06)
1,929 reads
The script shows one of ways generating number sequence - this one uses CTE.
2011-10-04 (first published: 2008-02-06)
1,929 reads
This function returns the difference between the date in text format
2011-10-03 (first published: 2011-08-30)
1,027 reads
2011-10-03 (first published: 2008-03-27)
7,107 reads
Copy Multiple objects from One Schema to Another Schema
2011-09-30 (first published: 2011-09-07)
1,540 reads
A function to replace tab characters with the correct number of spaces to align the text as originally intended.
2011-09-29 (first published: 2007-10-11)
2,202 reads
Creates a resultset that expresses the last time a successful CHECKDB was performed on every database in the instance.
Does not work on SQL 2000.
2011-09-28 (first published: 2008-03-19)
4,962 reads
Find every object in every database owned by a particular Login.
2011-09-27 (first published: 2008-07-07)
11,156 reads
2011-09-26 (first published: 2011-09-14)
1,793 reads
Generate Script to create all secondary indexes for a database. I have included the ability to generate online indexes if possible and the ability to move to another file group.
2011-09-23 (first published: 2008-07-05)
3,266 reads
A quick procedure to check which full recovery databases have not had a tran log backup in the given period (default is 7 days). This could mean that the recovery mode might need changing or the transaction log backup jobs need investigating.
2011-09-22 (first published: 2007-08-03)
1,708 reads
By Steve Jones
ecstatic shock – n. a surge of energy upon catching a glimpse from someone...
By Chris Yates
The New Arena of Leadership The role of the Chief Data Officer is no...
Presenting you with an updated version of our sp_snapshot procedure, allowing you to easily...
Just saw the "Azure Extension for SQL Server" Does anyone has experience with it?...
I've noticed several instances of what looks like a recursive insert with the format:...
Comments posted to this topic are about the item Cleaning Up the Cloud
I have a table with this data:
TravelLogID CityID StartDate EndDate 1 1 2025-01-01 2025-01-06 2 2 2025-01-01 2025-01-06 3 3 2025-01-01 2025-01-06 4 4 2025-01-01 2025-01-06 5 5 2025-01-01 2025-01-06I run this code:
SELECT IDENT_CURRENT('TravelLog')I get the value 5 back. Now I do this:
SET IDENTITY_INSERT dbo.TravelLog ON INSERT dbo.TravelLog ( TravelLogID, CityID, StartDate, EndDate ) VALUES (25, 5, '2025-09-12', '2025-09-17') SET IDENTITY_INSERT dbo.TravelLog OFFI now run this code.
DBCC CHECKIDENT(TravelLog) GO INSERT dbo.TravelLog ( CityID, StartDate, EndDate ) VALUES (4, '2025-10-14', '2025-10-17') GOWhat is the value for TravelLogID for the row I inserted for CityID 4 and dates starting on 14 Oct 2025? See possible answers