Getting Started with Adobe After Effects - Part 6: Motion Blur
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.

TSQL Challenge 62 - Break a long sentence in groups of 5 words

Read the input string and break each sentence into groups of 5 words. A row may contain more than one sentence. Each sentence in the input should start a new group.

Database Source Control in just 5 minutes
It takes just 5 minutes to connect your SQL databases to source control. Got 5 minutes to spare? Bring your database development process forward by 5 years. Get started now..

Sample Data

id comment
-- ---------------------------------------------------------------------
1  The upcoming release of SQL Server is codenamed Denali. It is 
   also called SQL11 which refers to version 11 and people misunderstand 
   it to be SQL Server 2011.
2  SQL Server Denali CTP 3 introduced a number of TSQL enhancements. 

Expected Results

id sentence group text
-- -------- ----- -----------------------------------
1         1     1 The upcoming release of SQL
1         1     2 Server is codenamed Denali
1         2     1 It is also called SQL11
1         2     2 which refers to version 11
1         2     3 and people misunderstand it to
1         2     4 be SQL Server 2011
2         1     1 SQL Server Denali CTP 3
2         1     2 introduced a number of TSQL
2         1     3 enhancements

Rules

  1. The expected results should be ordered by id, sentence, group.
  2. The rows in Sample Data is broken into multiple lines for display purpose only.

Sample Script

Use the TSQL Script given below to generate the source table and fill them with sample data.

IF OBJECT_ID('TC62','U') IS NOT NULL BEGIN
	DROP TABLE TC62
END
GO

CREATE TABLE TC62(
	id INT IDENTITY,
	comment VARCHAR(MAX)
)
GO

INSERT INTO TC62(comment)
SELECT 'The upcoming release of SQL Server is codenamed Denali. It is also called SQL11 which refers to version 11 and people misunderstand it to be SQL Server 2011.' UNION ALL
SELECT 'SQL Server Denali CTP 3 introduced a number of TSQL enhancements.' 

SELECT * FROM TC62

Restrictions

  1. The solution should be a single query that starts with a "SELECT" or “;WITH”

Notes

  1. Read the Submission Guidelines and make sure that your solution follows them.
  2. If you would like to use a Tally Table, you can use the script given here. Your solution should not include the script to create and populate the tally table. You can assume that the tally table will be available in the database where the evaluation team will run your Code.
Database Source Control in just 5 minutes
It takes just 5 minutes to connect your SQL databases to source control. Got 5 minutes to spare? Bring your database development process forward by 5 years. Get started now..

Madhivanan
3 · 40% · 12899
Submit a Solution
Previous Challenge
Next Challenge
6
Liked
9
Comments
50
Solutions



Submit

TSQL Challenge 62 - Break a long sentence in groups of 5 words

Managed Windows Shared Hosting by OrcsWeb

Copyright © Rivera Informatic Private Ltd.