Skip to content

Instantly share code, notes, and snippets.

Avatar

Kendra Little LitKnd

View GitHub Profile
View SQLCompareFilterExcludingUsers.scpf
<xml version="1.0" encoding="utf-8" standalone="yes"?>
<!--
RedGate.SQLCompare.UI
RedGate.SQLCompare.UI
Version:14.5.2.18630-->
<NamedFilter version="1" type="SQLCompareFilter">
<!--This filter can be loaded using the SQL Compare UI or used with a SQL Compare command line session using the /filter switch-->
<FilterName>SQLCompareFilterExcludingUsers</FilterName>
<Filter version="1" type="DifferenceFilter">
<FilterCaseSensitive>False</FilterCaseSensitive>
@LitKnd
LitKnd / test.sql
Created Oct 17, 2020
i can add a script
View test.sql
select * from sys.databases
View contained database user demo.sql
USE master;
GO
sp_configure 'show advanced options', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
sp_configure 'contained database authentication', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
View udf example with default constraint.sql
SET QUOTED_IDENTIFIER ON;
GO
SET ANSI_NULLS ON;
GO
/*******************************************
The code for this function contains extra steps, because SQL Server
does not allow you to alter a function if it is referenced by a default constraint
******************************************/
View clone-branch.ps1
#Modified from: https://documentation.red-gate.com/clone/automation/git-hooks
##########################################################################################
############################## clone-branch.ps1 version 0.2 ##############################
##########################################################################################
##################################### Configuration ######################################
#$VerbosePreference = "Continue" # Uncomment this line to enable verbose logging
$InformationPreference = "Continue" # Comment this line to disable information logging
View create n schemas with i tables each.sql
USE master;
GO
IF DB_ID('SchemaDeployDev') IS NOT NULL
BEGIN
ALTER DATABASE SchemaDeployDev SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE SchemaDeployDev;
END;
View altering views with two different syntaxes.sql
USE master;
GO
SET NOCOUNT ON;
GO
/*******************************************
Set up the database and table
********************************************/
View simple certificate and symmetric key.sql
CREATE DATABASE QuickTest
GO
USE QuickTest;
GO
CREATE CERTIFICATE SelfSignedCertificate
ENCRYPTION BY PASSWORD = 'helloiamapassword123'
WITH SUBJECT = 'Self Signed Cert Test',
View dependency queries.sql
SELECT s.name AS [ReferencingSchemaName],
oa.name AS [ReferencingObjectName],
oa.type_desc AS [ReferencingObjectType],
d.referenced_schema_name AS [ReferencedSchemaName],
da.name AS [ReferencedObjectName],
da.type_desc AS [ReferencedObjectType]
FROM sys.sql_expression_dependencies d
LEFT JOIN sys.all_objects oa
View partition-right-dates.sql
use master;
GO
SET NOCOUNT ON;
GO
IF DB_ID('Partitioning') IS NOT NULL
BEGIN
ALTER DATABASE Partitioning SET SINGLE_USER WITH ROLLBACK IMMEDIATE;