﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / Grouping a String by everything other than the last numbers considering they exist / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 20:18:11 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Grouping a String by everything other than the last numbers considering they exist</title><link>http://www.sqlservercentral.com/Forums/Topic1419230-392-1.aspx</link><description>Thanks Dwain, That was perfect. I really appreciate your help.</description><pubDate>Wed, 13 Feb 2013 08:49:08 GMT</pubDate><dc:creator>miker 8667</dc:creator></item><item><title>RE: Grouping a String by everything other than the last numbers considering they exist</title><link>http://www.sqlservercentral.com/Forums/Topic1419230-392-1.aspx</link><description>As you're new to SSC, I'd like to suggest that to get better and faster help, it helps your helpers if you'll post DDL and consumable sample data like this:[code="sql"]CREATE TABLE #Products (ID VARCHAR(100))INSERT INTO #ProductsSELECT '1/2CT-RDHL-FGI1-AMD7'UNION ALL SELECT '1/2CT-RDHL-FGI1-AMD8'UNION ALL SELECT '1/2-FG-I1-ATT'UNION ALL SELECT '1/2PR-RNG-ATT-10'UNION ALL SELECT '1/2PR-RNG-ATT-5'UNION ALL SELECT '1/2PR-RNG-ATT-6'UNION ALL SELECT '1/2PR-RNG-ATT-7'UNION ALL SELECT '1/2PR-RNG-ATT-8'UNION ALL SELECT '1/2PR-RNG-ATT-9'UNION ALL SELECT '1/2RDSL-HISI2-AMD-5'UNION ALL SELECT '1/2RDSL-HISI2-AMD-6'UNION ALL SELECT '1CT-LDB-SRNG/10'UNION ALL SELECT '1CT-LDB-SRNG/11'UNION ALL SELECT '1CT-LDB-SRNG/5'UNION ALL SELECT '1CT-LDB-SRNG/6'UNION ALL SELECT '1CT-LDB-SRNG/7'UNION ALL SELECT '1CT-LDB-SRNG/8'UNION ALL SELECT '1CT-LDB-SRNG/9'[/code]This makes it much easier for us volunteers to focus on possible solutions, such as this one:[code="sql"]SELECT [NewID]FROM #ProductsCROSS APPLY (    SELECT LEFT(ID, 1+LEN(ID)-PATINDEX('%[A-Za-z]%', REVERSE(ID)))) a([NewID])GROUP BY [NewID]DROP TABLE #Products[/code]</description><pubDate>Tue, 12 Feb 2013 18:08:41 GMT</pubDate><dc:creator>dwain.c</dc:creator></item><item><title>Grouping a String by everything other than the last numbers considering they exist</title><link>http://www.sqlservercentral.com/Forums/Topic1419230-392-1.aspx</link><description>Hey Guys, Our database has Unique SKU's for each product, however when it comes to Jewelry every size needs its own SKU. Something along the following lines:1/2CT-RDHL-FGI1-AMD71/2CT-RDHL-FGI1-AMD81/2-FG-I1-ATT1/2PR-RNG-ATT-101/2PR-RNG-ATT-51/2PR-RNG-ATT-61/2PR-RNG-ATT-71/2PR-RNG-ATT-81/2PR-RNG-ATT-91/2RDSL-HISI2-AMD-51/2RDSL-HISI2-AMD-61CT-LDB-SRNG/101CT-LDB-SRNG/111CT-LDB-SRNG/51CT-LDB-SRNG/61CT-LDB-SRNG/71CT-LDB-SRNG/81CT-LDB-SRNG/9I'd like to tally the stock by each product so I'd like to Group the SKU's if they are the same besides the last charachters, where they are numbers. Resulting with something along the following lines:1/2CT-RDHL-FGI1-AMD1/2-FG-I1-ATT1/2PR-RNG-ATT1/2RDSL-HISI2-AMD1CT-LDB-SRNGAny help would be greatly appreciated??</description><pubDate>Tue, 12 Feb 2013 15:59:24 GMT</pubDate><dc:creator>miker 8667</dc:creator></item></channel></rss>