title: How to loop through list of ID's
body: <p>I am getting list of id's in the select statement. How to loop through each id and print below</p>
  
  <pre><code>DECLARE @InventoryID INT
  Select @InventoryID = I.InventoryID
  From G2owner.LoadSlip L (nolock)
       Inner Join G2owner.LoadSlipReleaseOrderMapping LM (nolock) on L.LoadSlipID = LM.LoadSlipID
       Inner Join G2owner.LoadSlipDetail LSD (nolock) on LM.LoadSlipReleaseOrdermappingID = LSD.LoadSlipReleaseOrdermappingID 
       Inner Join G2owner.Inventory I (nolock) on LSD.InventoryID = I.InventoryID
  Where LM.ReleaseOrderID = 7156 and L.LoadSlipID = 3014
        and L.TerminalID = 3 and I.InventoryEndDate IS NULL and I.TotalNetWeight = 0.0000000
  
  PRINT @InventoryID
  </code></pre>