Search results for "gaps and islands"

Your search for "gaps and islands" returned 100 results:

Blog Post

Finding Data Gaps

  • Blog Post

Quality data is a goal we all strive to attain. Nobody wants to have bad data. Yet, despite our best efforts, the problem of bad data has its way...

2019-08-05 (first published: )

508 reads

Technical Article

T-Sql Logical Query

  • Topic

Hi all - I was presented with a request today which I'm completely stumped on. Here it is; Given an employees table with the columns ID, FirstName, LastName, HireDate, and TerminationDate how would you calculate the longest period in days that the company has gone without hiring or firing anyone. Any help would be greatly […]

You rated this post out of 5. Change rating

2013-03-05

49 reads

Technical Article

Count of consecutive years of participation (islands and gaps)

  • Topic

I have a data set (snippet below) and I need to count the number of consecutive years based on a date in time for each ID as represented below. ID DATE ------ -------- 1 2000-05-03 1 2001-06-10 1 2002-04-02 1 2005-07-29 1 2010-12-15 4 2001-05-07 4 1999-08-01 4 2000-07-05 4 2001-08-01 9 2002-05-01 9 2000-04-02 […]

You rated this post out of 5. Change rating

2015-06-29

1,676 reads

SQLServerCentral Article

An Efficient Set-based Solution for Islands and Gaps

  • Article

After reading a recent article on identifying islands and gaps in sequential numbers, one of our readers was inspired to develop a more efficient solution for fragmented data. New Author Goce Smilevski brings us his solution and supporting data to show how this can be done better.

2.33 (3)

You rated this post out of 5. Change rating

2021-04-16 (first published: )

11,051 reads

Technical Article

Merging date based on start and end date

  • Topic

I have tried to group/merge dates (Min/Max) but due to same data at line 1,2 and 4 , its not working as expected. Thank for looking into it. create table #Temp ( ID INT, Status_ID INT, StartDate DATE, EndDate DATE ) INSERT INTO #TEMP SELECT 101,1,'01/01/2020','01/28/2020' UNION ALL SELECT 101,1,'01/29/2020','01/31/2020' UNION ALL SELECT 101,5,'02/01/2020','02/29/2020' UNION […]

You rated this post out of 5. Change rating

2020-07-24

969 reads

Technical Article

TSQL Script: Min, Max function

  • Topic

Hello All, I hope you are doing well. I have difficulties to write a sql script. May be you could help me. I have a table like this. And I want to have a result like this:     I used the min and max function but it doesn't work. Do you have any idea […]

You rated this post out of 5. Change rating

2020-12-15

177 reads

Technical Article

Calculating Downtime in SQL

  • Topic

I am looking to find the downtime of my machines. All the information is being pulled from SQL views and tables. When the machines is ON it is =1. When it is off it is =0. Here is a sample of what it looks like queried. 2014-09-15 09:53:38.6730000 LimitSwitch 1 2014-09-15 10:17:30.7280000 LimitSwitch 0 I […]

You rated this post out of 5. Change rating

2014-09-15

82 reads

Blogs

Attacking the Weakest Link

By

When I look at a system and think about its security model, the first...

Migrate datetime data to datetimeoffset with AT TIME ZONE

By

I recently reviewed, worked on, and added a similar example to the DATETIMEOFFSET Microsoft...

The Comprehensive Guide to Mastering Your SQL DBA Skills

By

Database administrators (DBAs) are the backbone of data-driven organizations. If you're looking to break...

Read the latest Blogs

Forums

Multiple processes accessing the same table. some to write others to read / Lock

By river1

Dears, Hope this message finds you well We have a log table which is...

The Backup File Extension

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Backup File Extension

Ingest and Retrieve data from an ADX Cluster Using Python

By Sucharita Das

Comments posted to this topic are about the item Ingest and Retrieve data from...

Visit the forum

Question of the Day

The Backup File Extension

I run this command in SQL Server 2022. What is the extension of the backup file?

BACKUP DATABASE HerdofTwo TO DISK = 'HerdOfTwo_20240501'

See possible answers