mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 09:59:48 -05:00
Update docs (#200)
This is a documentation-only update so automerging. Please review the commit if there are any follow-ups requested. * Update .gitignore for docfx genertated files * Update documenation (part 1) * Update docs and add some samples * More doc updates
This commit is contained in:
27
docs/samples/smo/PowerShellScript/dbiteration.ps1
Normal file
27
docs/samples/smo/PowerShellScript/dbiteration.ps1
Normal file
@@ -0,0 +1,27 @@
|
||||
<#
|
||||
This script demonstrates iterations through the rows and display collation details for a remote or local instance of SQL Server.
|
||||
#>
|
||||
|
||||
#DLL location needs to be specified
|
||||
$pathtodll = ""
|
||||
|
||||
Add-Type -Path "$pathtodll\Microsoft.SqlServer.Smo.dll"
|
||||
Add-Type -Path "$pathtodll\Microsoft.SqlServer.ConnectionInfo.dll"
|
||||
|
||||
#Connection context need to be specified
|
||||
$srv = New-Object Microsoft.SqlServer.Management.Smo.Server()
|
||||
$srv.ConnectionContext.LoginSecure = $false
|
||||
$srv.ConnectionContext.ServerInstance = "instance_name"
|
||||
$srv.ConnectionContext.Login = "user_id"
|
||||
$srv.ConnectionContext.Password = "pwd"
|
||||
|
||||
$datatable = $srv.EnumCollations()
|
||||
|
||||
Foreach ($row in $datatable.Rows)
|
||||
{
|
||||
Write-Host "============================================"
|
||||
Foreach ($column in $row.Table.Columns)
|
||||
{
|
||||
Write-Host $column.ColumnName "=" $row[$column].ToString()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user