Home Forums Programming Powershell How to find number of columns returned from query in powershell RE: How to find number of columns returned from query in powershell

  • Well I suppose if we have a row then we might be able to get somewhere but if we have an array of an array of items that is different. In order to check then you can do the following:

    $QueryResults[0].GetType().FullName

    If we have an array of arrays then we can do the following:

    $QueryResults[0].Count

    Otherwise if we have a DataRow then we can do the following:

    $QueryResults[0].Table.Columns.Count

    Otherwise I would need to think again.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!