title: Crystal Report For Dynamic Column
body: <p>I do a dynamic pivot sql query to get results like ,
  <img src="https://i.stack.imgur.com/U1ZzB.jpg" alt="enter image description here"></p>
  
  <p>ANd for that my query is given below,</p>
  
  <pre><code>    DECLARE @cols AS NVARCHAR(MAX),
      @query  AS NVARCHAR(MAX)
  
      select @cols = STUFF((SELECT distinct ',' + QUOTENAME(AssortmentSize) 
                      from tbl_Assortment_Qty WHERE Head_Id=325
              FOR XML PATH(''), TYPE
              ).value('.', 'NVARCHAR(MAX)') 
          ,1,1,'')
  
      set @query='SELECT                                                                      Description,AssortmentType, '+@cols+',ISNULL (size_unit_price,0) UnitPrice from 
               (
                  SELECT DISTINCT H.Description,AssortmentType,AssortmentSize,AssortmentQty,B.size_unit_price FROM dbo.tbl_Assortment_Qty Q
                  INNER JOIN 
  dbo.tbl_Fabric_Order_Head H
   ON H.Head_ID=Q.Head_ID
   LEFT OUTER JOIN
   dbo.Budget_Accessories_Qty B
   ON B.head_Id=Q.Head_Id
   AND B.accessories=Q.AssortmentType
  
   WHERE Q.head_id=325
   ) x
              pivot 
              (
                  SUM(AssortmentQty)
                  for AssortmentSize in (' + @cols + ')
              ) p '
  
  execute(@query)
  </code></pre>
  
  <p>Now I want to print the result datatable directly into Crystal report. I want it as it is, with the header names intact. Now I completely get stuck at this. I cant define columns fixed in crystal report, as they are Dynamic. The Size c(L,M,S,XL) may be other one, and I am not a crystal report expert. The most simple answer I require is, How to Print a DATATABLE directly into Crystal report, without defining its column fields??</p>