Created
September 7, 2011 20:07
-
-
Save zippy1981/1201583 to your computer and use it in GitHub Desktop.
Powershell script to demo Jorge's (@sqlchicken) Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cn = New-Object System.Data.SqlClient.SqlConnection 'Data Source=.;Initial Catalog=master;Integrated Security=SSPI;'; | |
$cn.Open(); | |
$cmd = $cn.CreateCommand() | |
$cmd.CommandText="SELECT * FROM sys.tables" | |
$rdr = $cmd.ExecuteReader(); | |
$dt = New-Object System.Data.DataTable; | |
$dt.Load($rdr); | |
$dt.Rows | Format-Table; | |
$dt.Dispose(); | |
$rdr.Dispose() | |
$cmd.Dispose(); | |
$cn.Dispose(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment