8
0
Skriptentwickung/test/sqltest.ps1
2024-01-24 16:42:38 +01:00

18 lines
1.8 KiB
PowerShell
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

cls
[String]$ConnString = "Data Source=SQL-SRV;Initial Catalog=DD_ECM;Trusted_Connection=True;TrustServerCertificate=true;"
#[String]$SQLQuery = "EXEC [dbo].[PRCUST_EXPORT_OCR_TO_WAWI] @pSTACK_ID = '1013_2100841558 (1)1013_2100841558 (100)', @pFILE_NAME = 'filename' "
[String]$SQLQuery = "SELECT [UID] FROM [DD_ECM].[dbo].[VWCUST_EXPORT_OCR_TO_WAWI_TODO]"
[bool]$bool = 0
Try {
$SQLResult = Invoke-Sqlcmd -Query $SQLQuery -ConnectionString $ConnString -OutputSqlErrors $bool
}
catch {
Write-Host "To avoid error messages about 'Invoke-Sqlcmd',"
Write-Host "make sure the webdav feature is installed!"
Write-Host "Powershell-Command: 'Install-Module -Name SqlServer'"
Write-Host ""
Write-Host $Error
}
#$SQLResult.item(0) | Select-Object -Property Country,FlagColors | ConvertTo-Json -Depth 1
$SQLResult #| Select-Object -Property Country,FlagColors | ConvertTo-Json -Depth 10