Powershell Script to Output All Tables in a Database to CSV for SQL Server

##################################################################### Run PowerShell To run PowerShell from SQL Server Management Studio Open Object Explorer. Navigate to the node for the object to be worked on. Right-click the object and select Start PowerShell.

Advertisements

Select Random Rows from Table in SQL Server

To Select 1 Random Records from a table in SQL Server   SELECT TOP 1 * FROM Table_Name ORDER BY NEWID() ;   To Select 10 Random Records from a table in SQL Server   SELECT TOP 10 * FROM tAudit ORDER BY NEWID()