Skip to content

Instantly share code, notes, and snippets.

View MarkPryceMaherMSFT's full-sized avatar

Mark Pryce-Maher MarkPryceMaherMSFT

View GitHub Profile
@MarkPryceMaherMSFT
MarkPryceMaherMSFT / number_check.sql
Created April 1, 2022 16:39
Sample test for check_my_number
-- code to test number check
select dbo.check_my_number('10') as test1
,dbo.check_my_number('boo') as test2
,dbo.check_my_number('10.1') as test3
,dbo.check_my_number('-10') as test4
-- simple function to wrap try_parse
create FUNCTION dbo.check_my_number (@value varchar(255))
RETURNS bigint
as
BEGIN
declare @rt bigint;
set @rt = try_parse(@value as bigint)
return @rt;
@MarkPryceMaherMSFT
MarkPryceMaherMSFT / UpdateExtendedPropertiesCustom.sql
Created March 12, 2018 20:06
Update Extended Properties custom
exec sp_updateextendedproperty @name=N'sys_sensitivity_label_name',
@level0type=N'schema',@level0name=N'Sales',@level1type=N'table',
@level1name=N'CustomerTransactions',@level2type=N'column',
@level2name=N'AmountExcludingTax',@value=N'Custom Confidential'
@MarkPryceMaherMSFT
MarkPryceMaherMSFT / UpdateExtendedProperties.sql
Created March 12, 2018 19:50
Script for updating Extented Properties
exec sp_updateextendedproperty @name=N'sys_sensitivity_label_name', @level0type=N'schema', @level0name=N'Sales',
@level1type=N'table', @level1name=N'CustomerTransactions', @level2type=N'column',
@level2name=N'AmountExcludingTax',@value=N'Confidential'
@MarkPryceMaherMSFT
MarkPryceMaherMSFT / GDPR.sql
Created March 12, 2018 17:20
Code observerd from the Data Classify function in SSMS 17.5
DECLARE @Dictionary TABLE
(
pattern NVARCHAR(128),
info_type NVARCHAR(128),
sensitivity_label NVARCHAR(128),
can_be_numeric BIT
)
INSERT INTO @Dictionary (pattern, info_type, sensitivity_label, can_be_numeric)
VALUES
('%username%' ,'Credentials' , 'Confidential' ,1),