Working with Basic .NET DataSets and DataTables in PowerShell

This is mostly for my reference, but you can use it, too :)

Create Basic Datatable


Create Basic DataSet (Collection of Tables)



Create Datatable from CSV

Using this method, you can add 140k rows a second.

Managing Duplicates

Create new table using another datatable’s schema

Filling DataTables and DataSets with data from SQL Server

Chrissy is a PowerShell MVP who has worked in IT for nearly 20 years, and currently serves as a Sr. Database Engineer in Belgium. Always an avid scripter, she attended the Monad session at Microsoft’s Professional Developers Conference in Los Angeles back in 2005 and has worked and played with PowerShell ever since. Chrissy is currently pursuing an MS in Systems Engineering at Regis University and helps maintain in her spare time. She holds a number of certifications, including those relating to SQL Server, SuSE Linux, SharePoint and network security. She recently became co-lead of the SQL PASS PowerShell Virtual Chapter. You can follow her on Twitter at @cl.

Posted in PowerShell, SQL Server
4 comments on “Working with Basic .NET DataSets and DataTables in PowerShell
  1. Colin says:

    Of all the googled PS DataSet explanations, this one is far and away the best.

    Thanks Chrissy.

  2. SB says:

    Colin; seconded.

  3. robduncan says:

    Great article – would love to see examples of loading xml files into datatables

Leave a Reply

Your email address will not be published. Required fields are marked *