Hello guys, I want to convert row to columns with rows dynamic .I have two table , i'll join them and get data.See atOk , i try convert rows to columns with PIVOT . i want the result asGROUP_MOD_ID ADD EDIT DELETEG02 1 0 1
CREATE PROC GET_FUNC @GID CHAR(5)ASBEGIN SELECT FUNCTION_MOD_NAME FROM ( SELECT TEMP.FUNCTION_MOD_NAME,TEMP.ALLOW FROM (SELECT A.GROUP_MOD_ID, B.FUNCTION_MOD_NAME,A.ALLOW FROM FUNCTION_GROUP A INNER JOIN FUNCTION_MOD B ON A.FUNCTION_MOD_ID = B.FUNCTION_MOD_ID WHERE A.GROUP_MOD_ID='G02') AS TEMP ) AS SOURCE_TBPIVOT ( ALLOW FOR FUNCTION_MOD_NAME IN (FUNCTION_MOD_NAME) ) AS PIVOT_TB END
But it's errorMsg 156, Level 15, State 1, Procedure GET_FUNC, Line 13Incorrect syntax near the keyword 'FOR'.
Note: Type of ALLOW is bit and rows FUNCTION_MOD_NAME is dynamicThank guys