Click here to Skip to main content
15,910,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi this is Ramesh.

i wrote the sql query(bellow). Actually the temp table #tblx have data. But when i am passing as select query it will return zero.

Please help me...


SQL
CREATE TABLE #TblX( Code varchar(20))
DECLARE @TblY TABLE(Code varchar(20))
INSERT #TblX
SELECT distinct Code FROM tbl_MainList

SELECT  feorcre,ClientID,[#TblX]
FROM
(SELECT distinct Code,feorcre,ClientID
FROM tbl_MainList where FeorCRE=@FeorCre  ) As Souce
PIVOT (COUNT(Code) FOR Code IN ([#TblX])) As p
Posted
Updated 2-Apr-12 23:29pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900