﻿<?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)  / query help / 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>Tue, 21 May 2013 17:49:33 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: query help</title><link>http://www.sqlservercentral.com/Forums/Topic1408240-392-1.aspx</link><description>This should also work:[code="sql"]SELECT newColumnFROM yourTable as ytCROSS APPLY (  VALUES (LEFT(yt.yourColumn,1)+'C')    ,(LEFT(yt.yourColumn,1)+'D') new (newColumn)[/code]</description><pubDate>Thu, 17 Jan 2013 17:32:31 GMT</pubDate><dc:creator>dwain.c</dc:creator></item><item><title>RE: query help</title><link>http://www.sqlservercentral.com/Forums/Topic1408240-392-1.aspx</link><description>Cool. Thanks. I was trying this by creating temp table and then making CROSS JOIN. But definitely it's better. :-)</description><pubDate>Thu, 17 Jan 2013 04:51:54 GMT</pubDate><dc:creator>sqlnaive</dc:creator></item><item><title>RE: query help</title><link>http://www.sqlservercentral.com/Forums/Topic1408240-392-1.aspx</link><description>[quote][b]sqlnaive (1/17/2013)[/b][hr]In a table, I have value like this:1A2AI want data like this:1C1D2C2Dthat is for each value of A in table, i want two records with C and D.[/quote][code="sql"]SELECT newColumnFROM yourTable as ytCROSS APPLY (  SELECT LEFT(yt.yourColumn,1)+'C'  UNION ALL  SELECT LEFT(yt.yourColumn,1)+'D'  ) AS new(newColumn)[/code]Without table definitions and sample data, this is just a sample showing how CROSS APPLY can be used to expand 1 row to many...</description><pubDate>Thu, 17 Jan 2013 03:10:03 GMT</pubDate><dc:creator>mister.magoo</dc:creator></item><item><title>query help</title><link>http://www.sqlservercentral.com/Forums/Topic1408240-392-1.aspx</link><description>In a table, I have value like this:1A2AI want data like this:1C1D2C2Dthat is for each value of A in table, i want two records with C and D.</description><pubDate>Thu, 17 Jan 2013 02:30:56 GMT</pubDate><dc:creator>sqlnaive</dc:creator></item></channel></rss>