Skip to content

Instantly share code, notes, and snippets.

View JerryNixon's full-sized avatar
🤔
Trying to make a living.

Jerry Nixon JerryNixon

🤔
Trying to make a living.
View GitHub Profile
@JerryNixon
JerryNixon / TemporalTable.sql
Created February 6, 2026 17:25
Time Travel in Azure SQL
------------------------------------------------------------
-- Temporal Tables demo (idempotent, all in one script)
-- Uses unique table names to avoid conflicts with other demos
------------------------------------------------------------
------------------------------------------------------------
-- Reset (safe to rerun)
------------------------------------------------------------
IF OBJECT_ID('dbo.TodosTemporal', 'U') IS NOT NULL
BEGIN
@JerryNixon
JerryNixon / DataMasking.sql
Created February 6, 2026 16:28
Masking Sensitive Data in Azure SQL
------------------------------------------------------------
-- Dynamic Data Masking demo (SSN, Email, Phone)
-- Idempotent all-in-one script
------------------------------------------------------------
------------------------------------------------------------
-- Step 1: Create user
------------------------------------------------------------
IF NOT EXISTS (SELECT 1 FROM sys.database_principals WHERE name = 'AppUser')
BEGIN
@JerryNixon
JerryNixon / SoftDelete.sql
Created February 5, 2026 23:05
Enable Soft Delete in Azure SQL/Server
------------------------------------------------------------
-- Enable Soft Delete in Azure SQL using Row-Level Security
-- Fully idempotent, correct dependency ordering
------------------------------------------------------------
------------------------------------------------------------
-- Step 1: Create database, login, and user
------------------------------------------------------------
USE master;
GO
@JerryNixon
JerryNixon / mask.sql
Created May 14, 2025 21:22
Use data masking in SQL Server
DROP USER IF EXISTS PeopleReader;
DROP TABLE IF EXISTS People;
CREATE TABLE People
(
Id INT PRIMARY KEY,
Name VARCHAR(100),
SSN VARCHAR(11) MASKED WITH
(FUNCTION = 'partial(0,"XXX-XX-",4)')
);
@JerryNixon
JerryNixon / HealthCheck_RestApi.cs
Created February 25, 2025 20:53
Create a health check for REST web api
using System.Text.Json;
using Health;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using System.Diagnostics;
internal class Program
{
private static void Main(string[] args)
{
@JerryNixon
JerryNixon / create.sql
Last active January 9, 2025 21:19
TSQL to read & write SQL extended property: MS_Description
CREATE TABLE dbo.STATE (
ID INT PRIMARY KEY,
Name NVARCHAR(50),
Description NVARCHAR(255)
);
EXEC sp_addextendedproperty
@name = N'MS_Description',
@value = N'Table holding state information',
@level0type = N'user', @level0name = dbo,
@JerryNixon
JerryNixon / program.cs
Last active January 5, 2025 06:29
Console Keyboard
using System.Drawing;
public class Program
{
static Program()
{
Console.Clear();
Console.CursorVisible = false;
}
@JerryNixon
JerryNixon / demo.ipynb
Created December 12, 2024 21:13
.NET Notebook connection to local SQL container rinning DAB Star Trek
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JerryNixon
JerryNixon / GetTicTacToeWinner.sql
Created October 3, 2024 02:59
Calculate Tic Tac Toe winner in SQL
CREATE FUNCTION dbo.GetTicTacToeWinner(
@Cell1 CHAR(1),
@Cell2 CHAR(1),
@Cell3 CHAR(1),
@Cell4 CHAR(1),
@Cell5 CHAR(1),
@Cell6 CHAR(1),
@Cell7 CHAR(1),
@Cell8 CHAR(1),
@Cell9 CHAR(1)
@JerryNixon
JerryNixon / Metric-Duration.cs
Last active September 25, 2024 20:12
Open Telemetry 001
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
using System.Diagnostics;
using System.Diagnostics.Metrics;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<EndpointMeters>();
builder.Services.AddOpenTelemetry()
.WithMetrics(options =>