Skip to content

Instantly share code, notes, and snippets.

View SQLvariant's full-sized avatar

Aaron Nelson SQLvariant

View GitHub Profile
@SQLvariant
SQLvariant / DockerDesktop-with-SQL-PowerShell-90.ipynb
Last active March 27, 2021 12:14
Create a SQL-on-Linux Docker Container with a Host Mount and Restore the AdventureWorks2016 Database
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / Build_SQLInstance_wStringCreds.ps1
Created September 29, 2020 17:06
Use Invoke-ExecuteNotebook to build a SQL-on-Linux instance in a Docker container, by calling a Notebook to execute, and passing in the sa_password to the Notebook as a parameter.
Invoke-ExecuteNotebook -InputNotebook .\DockerDesktop-with-SQL-PowerShell-90.ipynb -Parameters @{sa_password = 'Test9999'}
@SQLvariant
SQLvariant / Build_SQLInstance_wStringCreds_andPortNumber.ps1
Last active January 28, 2023 22:28
Use Invoke-ExecuteNotebook to build a SQL-on-Linux instance in a Docker container, by calling Invoke-ExecuteNotebook to execute the Notebook, and passing in the sa_password & digits for the name/port number to the Notebook as a parameter.
Invoke-ExecuteNotebook -InputNotebook .\SQL-on-Docker-with-PowerShell.ipynb -Parameters @{sa_password = 'Test9999'; SQLNumber = 97}
Get-RsDeploymentConfig -RsProjectFile 'C:\Repos\GitHub\ReportingServicesTools\Tests\CatalogItems\testResources\TestProjects\SQLServerPerformanceDashboardReportingSolution\SQL Server Performance Dashboard\SQL Server Performance Dashboard.rptproj' -ConfigurationToUse Release
FullPath : Release
OverwriteDatasets : False
OverwriteDataSources : False
TargetReportFolder : SQL Server Performance Dashboard
TargetDatasetFolder : /Datasets
TargetDatasourceFolder : /Data Sources
TargetReportPartFolder : Report Parts
TargetServerURL : http://localhost/reportserver
@SQLvariant
SQLvariant / Invoke-DaxQuery.Test.ps1
Last active April 19, 2022 07:47
PowerShell function to run a DAX query against a Power BI Repot / Analysis Services, and accompanying Pester test (which requires a separate .PBIX file that I haven't published yet)
Describe "Invoke-DaxQuery" {
Context "Invoke a DAX Query and test the result"{
# Run queries and compare them
$results = Invoke-DaxQuery -DAXQuery "EVALUATE ReportCatalogQuery"
# Test if the config was retrieved
It "Should verify the count is correct by comparing against a static number" {
@($results).Count | Should -Be 36
}
@SQLvariant
SQLvariant / Query_DB2.ps1
Created November 20, 2020 16:12
Uploaded via PowerShell
$dbName="SAMPLE"
$server="not.my.localhost"
#Define connection string for the database
$cn = new-object system.data.OleDb.OleDbConnection("server=$($server);Provider=IBMDADB2;DSN=$($dbName);trusted_connection=true;");
#Define data set for first query
$ds = new-object "System.Data.DataSet" "ds"
#Define query to run
$q = "select * from hello_world"
# Define data object given the specific query and connection string
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLvariant
SQLvariant / Invoke-DB2Query.ps1
Last active March 27, 2021 12:13
PowerShell function for running a query against a DB2 database.
function Invoke-DB2Query
{
<#
.SYNOPSIS
This function runs a query against a DB2 database.
.DESCRIPTION
This function runs a query against a DB2 database using the account of the user executing the command.
.PARAMETER Server
@SQLvariant
SQLvariant / Out-DataTable.ps1
Created August 3, 2021 12:47
v1.1 of Chad Miller's Out-DataTable PowerShell function
#######################
<#
.SYNOPSIS
Creates a DataTable for an object
.DESCRIPTION
Creates a DataTable based on an objects properties.
.INPUTS
Object
Any object can be piped to Out-DataTable
.OUTPUTS
@SQLvariant
SQLvariant / Set AzSQL AAD to Remote Group.ipynb
Last active August 23, 2022 20:21
PowerShell commands for setting the AAD Auth of an Azure SQL instance to a Remote Group in a different tenant
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.