Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Common Table Expressions SQL SERVER

Author  Topic 

jimmyjazz1978
Starting Member

11 Posts

Posted - 2012-05-25 : 04:56:06
I have a table with 2 columns that should only contain one value but some entries contains 2 or 3 values . all the other columns are the same for these problem rows .

Table A - Currently Deal ID | PA ID | other columns 1 2 xxxxx 1,2 2 xxxxx 3 1,5 xxxxx What I want

Deal ID | PA ID | other columns 1 2 xxxxx 1 2 xxxxx 2 2 xxxxx 3 1 xxxxx 3 5 xxxxx Not sure how to do this ? Think I need to UNPIVOT and then remove the ,.


Bizzare

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-25 : 10:32:03
see scenario 4

http://visakhm.blogspot.com/2010/01/multipurpose-apply-operator.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -