Tag Archives: Tsql challenge

TSQL Challenge

On the series of TSQL Challenges, here is the next challenge. The requirement is to group the same parent when they have same child information. Below is the sample source records where the expectation is to merge the Usage by … Continue reading

Posted in T-SQL | Tagged , , , , , , , , , , | Leave a comment

TSQL Challenge

On the series on SQL challenges, below is the next puzzle/challenge and the requirement is to find out the person name who has both mango and apple Table 1: @Person contains Person NameTable 2: @PersonFruits contains the available fruits per … Continue reading

Posted in SQL SERVER 2008, T-SQL | Tagged , , , , , | Leave a comment

TSQL : Update columns with different values randomly

Continuing the series on SQL challenges. I came across a requirement from an online Tech forum where the request was to perform an update on a table column with a sequence of values randomly I have tried to write a … Continue reading

Posted in SQL SERVER 2008, T-SQL | Tagged , , , | 1 Comment

T-SQL : Gaps and Islands Problem – 2

There are lot of ways to find the gaps in a sequential numbers, and some of them are listed below. I have posted some 3 methods to achieve the expected. The goal is to find the gaps between the sequential … Continue reading

Posted in T-SQL | Tagged , , , | Leave a comment

T-SQL : An Interesting Question – 3

The requirement is as follows, Filter out records that has three or more words in it (or) Filter out records that has two or more spaces in it There are several ways to perform this and i would like to … Continue reading

Posted in T-SQL | Tagged , , | Leave a comment

T-SQL : An Interesting Question – 2

Another interesting question that I have read recently, which involves some string operations. Question: The whole string given is a alphanumeric (for ex: AP1AA). The requirement is to Stuff ‘0’ before the single digit number (0-9) which is enclosed by … Continue reading

Posted in T-SQL | Tagged , , , , | Leave a comment

TSQL : Parent-Child view to Flattened view using cursors

I recently came across of this requirement from one of my friends, he wanted the following table data to be viewed in a different format. Take a look at the following table   Members Parent Bikes Wheel Steering Tires Parent … Continue reading

Posted in T-SQL | Tagged , , , , , , , , | 1 Comment

How to convert YYYYMMDDHHMMSS to Date/Time/Datetime in sql server

In this thread, i would like to show some SQL queries that converts YYYYMMDDHHMMSS style formatted date-string into Sql Server datetime format Method 1: The simplest method to achieve this would be using a stuff() function like it is shown … Continue reading

Posted in T-SQL | Tagged , , , , , , , , , | 1 Comment