This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Adapted from ChilledSql.com */ | |
/* https://www.chilledsql.com/welcome/tip_category_dateandtime/tip_detail_dateandtime_createmastercalendartable */ | |
/* Update the Start/End dates as appropriate for your needs */ | |
/* This is done after all creates */ | |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED | |
SET NOCOUNT ON | |
SET ANSI_WARNINGS OFF | |
SET ARITHABORT OFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires gtts | |
# requires pydub | |
# requires ffmpeg to be installed on the system | |
from gtts import gTTS | |
from pydub import AudioSegment | |
import os | |
def generate_word_audio(word, output_folder='audio'): | |
if not os.path.exists(output_folder): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Code Type: Function | |
Description: Restore the missing Package(*.msi)/Patches(*.msp) files from another remote source (machine or folder). | |
Author: Ahmad Gad | |
Contact Email: ahmad.gad@jemmpress.com, ahmad.adel@jemmail.com | |
WebSite: http://ahmad.jempress.com | |
Created On: 21/09/2016 | |
Updated On: 11/03/2017 | |
Title: Restore-InstallerFiles | |
Minimum PowerShell Version: 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Get all db principals and their roles for Azure SQL */ | |
SELECT | |
@@ServerName as ServerName, | |
DB_NAME() as DatabaseName, | |
pr.name AS PrincipalName, | |
pr.type_desc AS PrincipalType, | |
r.name AS RoleName, | |
dp.state_desc AS RoleState, | |
NULL as PermissionName, | |
NULL as PermissionState, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import-module az.sql | |
import-module az.resources | |
import-module importexcel | |
# Update-AzConfig -DisplayBreakingChangeWarning $false | |
# sign in to Azure account | |
Connect-AzAccount | |
#Folder containing sql script and place to create Excel file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import-module az.sql | |
<# TODO | |
Based on: | |
https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-jobs-powershell-create?view=azuresql | |
* Add "Get" commants to top of script as appropriate | |
* Be able to loop through set of servers | |
* Document steps and/or separate files | |
* Parameterize passwords for master & job user accounts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use master | |
go | |
-- Adds a first step to specified job, which checks whether running on Primary replica | |
create procedure dbo.AddAGPrimaryCheckStepToAgentJob | |
@jobname nvarchar(128) | |
as | |
set nocount on; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @CustomerID INT | |
SELECT @CustomerID = ? | |
IF NOT EXISTS (SELECT * | |
FROM WideWorldImportsDW.Dimension.Customer | |
WHERE [WWI Customer ID] = @CustomerID) | |
INSERT WideWorldImportersDW.Dimension.Customer | |
([WWI Customer ID], | |
Customer, | |
[Bill To Customer], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import-module dbatools | |
import-module ImportExcel | |
$servers="server1" | |
$date = get-date #format yyyymmdd | |
foreach ($server in $servers) { | |
$ExcelFile = "C:\path\$server_Users_And_Logins_$date.xlsx" | |
Get-DbaDbRoleMember -SqlInstance $server | Export-Excel -Path $ExcelFile -WorksheetName UserRoleMembers -AutoSize -AutoFilter -ExcludeProperty @("ItemArray", "RowError", "RowState", "Table", "HasErrors") -BoldTopRow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module dbatools | |
Import-Module sqlserver #used for Invoke-SqlCmd to run scripts w/ the "GO" batch separator | |
$CurrentDate = (Get-Date).ToString("yyyyMMdd_hhmmss") | |
$Servername = "localhost" | |
$databases = 'CSV_Set_Of_DB_Names' | |
#Get permissions for databases |
NewerOlder