I want to get the data using Pivot dynamically but not able to get if possible then please let me know i'm sending my query here below
SELECT * FROM(
SELECT ROW_NUMBER() OVER (PARTITION BY IAI_COVERNUMBER,IAI_VERNO ORDER BY IAI_COVERNUMBER) AS RNO, IAI_COVERNUMBER AS INSGRP
FROM IAI_ACTUALINSURERS INNER JOIN PLY_POLICY ON (IAI_COVERNUMBER=PLY_COVERNUMBER AND IAI_VERNO=PLY_VERNO)
WHERE IAI_COVERNUMBER in ('0011520','0010891')
) PIVOT (MIN(INSGRP)--,MIN(IAI_INSPROPORTION) AS INSPROP
FOR RNO IN (1,2,3,4,5));
here i've set RNO hard-coded but i want it the number of rows exist
SELECT ROW_NUMBER() OVER (PARTITION BY IAI_COVERNUMBER,IAI_VERNO ORDER BY IAI_COVERNUMBER) AS RNO
But i'm also using Pivot XML but it is giving me output in XML sting in a single column
but i want INSGRP values in no. of columns as above that will give us 2 columns ....it may be more than 2 columns
Please provide the solution if anybody has face or know solution.
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bikesh SrivastavaPosted Jan 11, 2017, 6:09 AM