Skip to content

Instantly share code, notes, and snippets.

View SQLDBAWithABeard's full-sized avatar
🦄
Generally bearding

Rob Sewell SQLDBAWithABeard

🦄
Generally bearding
View GitHub Profile
@SQLDBAWithABeard
SQLDBAWithABeard / ForGitHub.ipynb
Created May 1, 2020 11:13
public github notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLDBAWithABeard
SQLDBAWithABeard / notebook agent job .ps1
Created March 31, 2020 15:44
notebook Agent job powershell
$TargetDatabase = "DBA"
$JobId = "$(ESCAPE_SQUOTE(JOBID))"
$StartTime = "$(ESCAPE_SQUOTE(STRTTM))"
$StartDate = "$(ESCAPE_SQUOTE(STRTDT))"
$JSONTable = "select * from notebooks.nb_template where job_id = $JobId"
$sqlResult = Invoke-Sqlcmd -Query $JSONTable -Database $TargetDatabase -MaxCharLength 2147483647
$FirstNotebookError = ""
function ParseTableToNotebookOutput {
param (
[System.Data.DataTable]
@SQLDBAWithABeard
SQLDBAWithABeard / Grouping logins by day.ipynb
Created March 31, 2020 15:20
Extended Event group logins by day Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
CREATE EVENT SESSION [MonitorWindowsLogins] ON SERVER
ADD EVENT sqlserver.login(
ACTION(sqlserver.client_hostname,sqlserver.database_name,sqlserver.session_id,sqlserver.session_nt_username,sqlserver.session_server_principal_name)
WHERE ([sqlserver].[not_equal_i_sql_unicode_string]([sqlserver].[session_nt_user],N'')
AND [sqlserver].[not_equal_i_sql_unicode_string]([sqlserver].[session_server_principal_name],N'THEBEARD\gsartori')
AND [sqlserver].[not_equal_i_sql_unicode_string]([sqlserver].[session_server_principal_name],N'THEBEARD\wdurkin')
AND [sqlserver].[not_equal_i_sql_unicode_string]([sqlserver].[session_server_principal_name],N'THEBEARD\Rob')
AND [sqlserver].[session_nt_user]<>N'THEBEARD\gfritchey'
AND [sqlserver].[session_server_principal_name]<>N'THEBEARD\SQL_SVC'
AND [sqlserver].[session_server_principal_name]<>N'THEBEARD\SQL2014SER12R2$'))
function Calm {
for ($i = 0; $i -le 4; $i++) {
$x = 1
while ($x -le 4) {
"In through the nose - $x"
Start-Sleep -Seconds 1
$x ++
}
$x = 1
while ($x -le 7) {
@SQLDBAWithABeard
SQLDBAWithABeard / DMA PowerShell notebook.ipynb
Last active June 29, 2022 01:46
DMA PowerShell and Azure Data Studio Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLDBAWithABeard
SQLDBAWithABeard / pesterwontrun.ipynb
Last active February 22, 2020 13:18
Pester wont run
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLDBAWithABeard
SQLDBAWithABeard / dbatools.ipynb
Created February 7, 2020 10:41
.NET Notebooks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLDBAWithABeard
SQLDBAWithABeard / fail.ipynb
Created February 7, 2020 09:09
Failing .NET POwerShell Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLDBAWithABeard
SQLDBAWithABeard / weird.ipynb
Last active January 30, 2020 21:19
strange behaviour in PowerShell Notebook with function and comment code
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.