Wednesday, September 29, 2010

PIVOT CAST / sum varchar is not working Sql-server

PIVOT CAST / sum varchar is not working Sql-server  2008/2005 , you have to change in select from table like following:-

 
SELECT
[310],

[520-530]

,

[850]

FROM

( SELECT [focomp],

cast(FOBUFMED1QT as int) FOBUFMED1QT

FROM BOFASY

) p PIVOT ( SUM(FOBUFMED1QT)

FOR [focomp] IN ([310], [520-530],[850] )

) AS pvt

No comments: