I wanted to be able to make some messaging stand out while running Azure Pipeline Builds. This is ultimately what worked for me.
Some simple examples of how to use the variables listed below.
| -- Kill all transactions in a database during a restore to avoid issues with exclusive access. | |
| DECLARE @SQL VARCHAR(8000) | |
| SELECT @SQL=COALESCE(@SQL,'')+'Kill '+CAST(spid AS VARCHAR(10))+ '; ' | |
| FROM sys.sysprocesses | |
| WHERE DBID=DB_ID('AdventureWorks') | |
| PRINT @SQL --EXEC(@SQL) Replace the print statement with exec to execute |
| /* SQL: Get total and average row count per table and/or database */ | |
| USE SomeDB; | |
| GO | |
| CREATE TABLE #counts | |
| ( | |
| table_name varchar(255), | |
| row_count int | |
| ) |
| trigger: | |
| branches: | |
| include: | |
| - develop | |
| - master | |
| paths: | |
| include: | |
| - ./ | |
| resources: |
You can create/add/update/get a Windows System DSN pretty easily with Powershell.
Database, SystemDSN, Server
AAA, AAA_DSN, SomeIP\User| Outlook version(s) | Code |
|---|---|
| All Windows Outlook (Most common) | <!--[if mso]> your code <![endif]--> |
| Outlook 2000 | <!--[if mso 9]> your code <![endif]--> |
| Outlook 2002 | <!--[if mso 10]> your code <![endif]--> |
| Outlook 2003 | <!--[if mso 11]> your code <![endif]--> |
| Outlook 2007 | <!--[if mso 12]> your code <![endif]--> |
| Outlook 2010 | <!--[if mso 14]> your code <![endif]--> |
| # get latest tag for the current branch | |
| git describe --tags | |
| # outputs > v*.*.*-{hash} | |
| # get latest tag for the current branch without the hash | |
| git describe --tags --abbrev=0 | |
| # outputs > v*.*.* | |
| # get latest tag across all branches | |
| git describe --tags $(git rev-list --tags --max-count=1) |
| /* | |
| Example of how to update a table in SQL using a Common Table Expression (CTE) | |
| */ | |
| USE [SomeTable] | |
| GO | |
| ;WITH cte AS ( | |
| SELECT te.LandEntityId, te.BirthDate, te.BirthDateId, dd.DateId | |
| FROM TypedEntity te |
| USE [SomeDB] | |
| GO | |
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| SET ANSI_PADDING ON |