Skip to content

Instantly share code, notes, and snippets.

@martin-guth
Created November 21, 2019 20:04
Show Gist options
  • Save martin-guth/330141455d5e5e8f7a5163a86b72b02d to your computer and use it in GitHub Desktop.
Save martin-guth/330141455d5e5e8f7a5163a86b72b02d to your computer and use it in GitHub Desktop.
An example for a call of the script exportReport.ps1
[String] $dateFrom = $(Get-Date).AddMonths(-1).ToString("yyyyMM01 00:00:00")
[String] $dateTo = Get-Date -Format "yyyyMM01 00:00:00"
[String] $month = $dateFrom.Substring(0,6)
echo "$dateFrom $dateTo $month";
& "X:\Scripts\exportReport.ps1" -databaseServer "mydbserver" -databaseName "mydb" -sqlFile "mySqlFile.sql" -fileName "FancyExport" -fileNameSupplement "_$month" -parameters "DECLARE @dateTimeFrom DATETIME = '$dateFrom', @dateTimeTo DATETIME = '$dateTo';"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment