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

  • Jeff Moden (7/25/2014)


    Chand00 (7/25/2014)


    Hi,

    Thank you. Below one worked for me.

    $QueryResults[0].Table.Columns.Count

    Apologies. I tried to post but I was unable to post somehow. Once again Thankyou

    Still, why does this need to be done from PowerShell? What is the overall task that you're trying to accomplish?

    Just to supply the T-SQL answer to the thread, the stored procedure sp_describe_first_result_set does the job.

    😎