June 16, 2011 at 1:28 am
Hi,
I have a set of rows that need to be pivoted. Pls find the table strucutre below.
RowID Int Auto Identity
Col1 Int Primary Key
Col2 Int Primary Key
Col3 Int Primary Key
Col4 Int Primary Key
Col5 Int Primary Key
ErrorCD varchar(10)
In the above table each composite Pkey will be having more than one error code. When we query this table this looks like as below...
RowID
June 16, 2011 at 1:32 am
You hit the "Submit" button before u completed the question, right? i dont find the requirement there :w00t:
June 16, 2011 at 5:44 am
We definitely need more information. If that is all the information, though, then FYI: Pivot does not work if you don't have something to aggregate on.
You need to SUM() or COUNT() or something (usually SUM()) in order to be able to use the actual PIVOT command. If you don't have that, then you'll need to come up with some sort of RBAR loop or cursor to force it.
June 16, 2011 at 5:46 am
DUPLICATE POST! Please direct all responses here: http://www.sqlservercentral.com/Forums/Topic1126304-149-1.aspx
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply