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 RiskMan; | |
go | |
set nocount, xact_abort on; | |
go | |
drop view if exists | |
Risk.MyDatabaseRisks_V, | |
Risk.AllRisks_V, | |
Risk.AllDatabaseRisks_V; | |
go |
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 tempdb; | |
go | |
set nocount, xact_abort on; | |
go | |
drop table if exists Attendance, ClassDate, Person, AttendanceType; | |
go | |
drop table if exists Person; | |
create table Person ( |
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
-- This script can be ran repeatedly on an instance of Microsoft SQL Server. | |
-- Objects are created in tempdb. | |
---------------- | |
-- Background -- | |
---------------- | |
-- The document titled 'SG Hierarchy Document' contains the following excerpt: | |
-- | |
-- Common Table Expression |
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
-- https://azure.microsoft.com/en-us/blog/finding-circular-foreign-key-references/ | |
use tempdb; | |
--alter table A drop constraint FK1; | |
drop table if exists D; | |
drop table if exists C; | |
drop table if exists B; | |
drop table if exists A; |
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
-------------------------------------------------------- | |
-- Insert one row into all tables within the database -- | |
-------------------------------------------------------- | |
-- Works On My Machine (TM) when tested with the AdventureWorks 2019 backup | |
use AdventureWorks2019; | |
set nocount on; | |
go |
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
-------------------------------------------------- | |
-- Transaction misuse messages | |
-------------------------------------------------- | |
exec sp_addmessage | |
@msgnum = 100001, | |
@msgtext = N'%s: is a transaction, which is Atomic. It has been called from within an open transaction, which would render it a non-transaction. That is not allowed.', | |
@severity = 16, | |
@lang = 'us_english', | |
@with_log = 'false', | |
@replace = 'replace'; |
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
create procedure dbo.Attendance_Add_tr | |
@OrganisationId int, | |
@PersonId int, | |
@AttendanceDate date | |
as | |
-- MSSQL equivalent of disabling chained transaction | |
set implicit_transactions off; | |
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
create procedure dbo.Attendance_Add_tr | |
@OrganisationId int, | |
@PersonId int, | |
@AttendanceDate date | |
as | |
set nocount on; | |
------------------------------------------------------------ | |
-- Validation block |
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
create procedure dbo.AddAttendance_tr | |
@OrganisationId int, | |
@PersonId int, | |
@AttendanceDate date | |
as | |
set nocount on; | |
------------------------------------------------------------ | |
-- Validation block |
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
# Assumption: Your remotes are configured as 'origin' (for personal fork) and 'upstream' (for shared git repo). | |
# First, make sure your local workspace is clean | |
git status | |
# If it isn't, either create a WIP branch OR stash your changes | |
# WIP branch: | |
git checkout -b my-current-WIP-19-mar-2021 | |
git add * | |
git commit -m 'WIP' |
NewerOlder