Q&A for programmers
declare @t table ( QuoteRef int, ProductA int, ProductB int, ProductC int, ProductD int ); INSERT INTO @t VALUES(12, 222333, 474884, 0, 0); ;WITH data as ( SELECT [QUOTERef], [ProductLine], [Value] FROM ( SELECT [QUOTERef], [ProductA], [ProductB], [ProductC], [ProductD] FROM @t) p UNPIVOT ([Value] FOR [ProductLine] IN ([ProductA], [ProductB], [ProductC], [ProductD] ) )AS unpvt ) SELECT * FROM DATA WHERE Value <> 0
Error: looks like you typed in the wrong words - try again