Skip to content

Instantly share code, notes, and snippets.

@martin-guth
Created November 21, 2019 20:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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