diff --git a/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createindex.snippet b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createindex.snippet new file mode 100644 index 0000000..3c31ba2 --- /dev/null +++ b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createindex.snippet @@ -0,0 +1,55 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Index + mycreateindex + Creates an index. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Sample_Table + + + Columnname + Name of the column + Sample_Column + + + Uniqueness + UNIQUE or empty + UNIQUE + + + + + + +
+
+ diff --git a/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createmanytomanyreference.snippet b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createmanytomanyreference.snippet new file mode 100644 index 0000000..ce54a8e --- /dev/null +++ b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createmanytomanyreference.snippet @@ -0,0 +1,122 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Many to Many Reference Table + mycreatemanyref + Creates a many to many reference table. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Invoice + + + PrimaryKey + Name of the refered key column + Id + + + Rolename + Name of the role + Customer + + + ForeignKeyPostfix + Postfix of the foreign key column + Id + + + RefSchemaName + Name of the referenced schema + dbo + + + RefTablename + Name of the referenced table + Customer + + + RefPrimaryKey + Name of the referred key column of the referenced table + Id + + + OnUpdate1 + ON UPDATE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + OnDelete1 + ON DELETE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + OnUpdate2 + ON UPDATE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + OnDelete2 + ON DELETE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + +---> [$RefSchemaName$].[$RefTablename$] +-- ------------------------------------------------------------ + +-- Create many-to-many reference table: +CREATE TABLE [$SchemaName$].[$Tablename$_$Rolename$] +( + [$Tablename$$ForeignKeyPostfix$] int NOT NULL, + [$RefTablename$$ForeignKeyPostfix$] int NOT NULL, + CONSTRAINT [PK_$Tablename$_$Rolename$] PRIMARY KEY CLUSTERED ([$Tablename$$ForeignKeyPostfix$] ASC, [$RefTablename$$ForeignKeyPostfix$] ASC) +) ON [PRIMARY] +GO + +-- Create the foreign key constraint and check it for existing data: +ALTER TABLE [$SchemaName$].[$Tablename$_$Rolename$] WITH CHECK ADD CONSTRAINT [FK_$Tablename$_$Rolename$_$Tablename$] FOREIGN KEY([$Tablename$$ForeignKeyPostfix$]) +REFERENCES [$SchemaName$].[$Tablename$] ([$PrimaryKey$]) + ON UPDATE $OnUpdate1$ + ON DELETE $OnDelete1$ +GO + +ALTER TABLE [$SchemaName$].[$Tablename$_$Rolename$] WITH CHECK ADD CONSTRAINT [FK_$Tablename$_$Rolename$_$Rolename$] FOREIGN KEY([$RefTablename$$ForeignKeyPostfix$]) +REFERENCES [$RefSchemaName$].[$RefTablename$] ([$RefPrimaryKey$]) + ON UPDATE $OnUpdate2$ + ON DELETE $OnDelete2$ +GO + +-- Enable the constraint for future data: +ALTER TABLE [$SchemaName$].[$Tablename$_$Rolename$] CHECK CONSTRAINT [FK_$Tablename$_$Rolename$_$Tablename$] +GO + +ALTER TABLE [$SchemaName$].[$Tablename$_$Rolename$] CHECK CONSTRAINT [FK_$Tablename$_$Rolename$_$Rolename$] +GO + +$end$]]> + + +
+
+ diff --git a/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createreference.snippet b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createreference.snippet new file mode 100644 index 0000000..3201762 --- /dev/null +++ b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createreference.snippet @@ -0,0 +1,93 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Foreign Key Reference + mycreateref + Creates a foreign key reference. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Invoice + + + Rolename + Name of the role + Customer + + + ForeignKeyPostfix + Postfix of the foreign key column + Id + + + RefSchemaName + Name of the referenced schema + dbo + + + RefTablename + Name of the referenced table + Customer + + + PrimaryKey + Name of the refered key column + Id + + + OnUpdate + ON UPDATE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + OnDelete + ON DELETE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + +---> [$RefSchemaName$].[$RefTablename$] +-- ------------------------------------------------------------ + +-- Create an index on the foreign key column: +CREATE NONCLUSTERED INDEX [IX_$Tablename$_$Rolename$$ForeignKeyPostfix$] ON [$SchemaName$].[$Tablename$] ([$Rolename$$ForeignKeyPostfix$] ASC) +GO + +-- Create the foreign key constraint and check it for existing data: +ALTER TABLE [$SchemaName$].[$Tablename$] WITH CHECK ADD CONSTRAINT [FK_$Tablename$_$Rolename$] FOREIGN KEY([$Rolename$$ForeignKeyPostfix$]) +REFERENCES [$RefSchemaName$].[$RefTablename$] ([$PrimaryKey$]) + ON UPDATE $OnUpdate$ + ON DELETE $OnDelete$ +GO + +-- Enable the constraint for future data: +ALTER TABLE [$SchemaName$].[$Tablename$] CHECK CONSTRAINT [FK_$Tablename$_$Rolename$] +GO + +$end$]]> + + +
+
+ diff --git a/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createschema.snippet b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createschema.snippet new file mode 100644 index 0000000..bf8f093 --- /dev/null +++ b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createschema.snippet @@ -0,0 +1,43 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Schema + mycreateschema + Creates a schema. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + + + + +
+
+ diff --git a/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createstoredprocedure.snippet b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createstoredprocedure.snippet new file mode 100644 index 0000000..0af7144 --- /dev/null +++ b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createstoredprocedure.snippet @@ -0,0 +1,54 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Stored Procedure + mycreatestoredprocedure + Creates a stored procedure. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Procname + Name of the stored procedure + usp_NewProcedure + + + + + + +
+
+ diff --git a/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createtable.snippet b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createtable.snippet new file mode 100644 index 0000000..3ae0bcc --- /dev/null +++ b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createtable.snippet @@ -0,0 +1,43 @@ + + + +
+ My Create Table + mycreatetable + Creates a table. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Sample_Table + + + + + + +
+
+ diff --git a/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createview.snippet b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createview.snippet new file mode 100644 index 0000000..3683436 --- /dev/null +++ b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/createview.snippet @@ -0,0 +1,47 @@ + + + +
+ My Create View + mycreateview + Creates a view. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Viewname + Name of the View + Sample_View + + + + + + +
+
+ diff --git a/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/insertwithidentity.snippet b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/insertwithidentity.snippet new file mode 100644 index 0000000..36a9a4e --- /dev/null +++ b/Microsoft SQL Server Management Studio/Code Snippets/SQL/My Code Snippets/insertwithidentity.snippet @@ -0,0 +1,56 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Insert with identity statements + myinsertidentity + Insert with identity statements. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Sample_Table + + + Columns + Extra columns to insert + + + + ValuesTemplate + Columns values template + + + + + + + +
+
+ diff --git a/Microsoft SQL Server Management Studio/Install on ManagementStudio.cmd b/Microsoft SQL Server Management Studio/Install on ManagementStudio.cmd new file mode 100644 index 0000000..b1246f6 --- /dev/null +++ b/Microsoft SQL Server Management Studio/Install on ManagementStudio.cmd @@ -0,0 +1,2 @@ +@ECHO OFF +XCOPY "%~dp0Code Snippets" "%USERPROFILE%\Documents\Visual Studio 2015\Code Snippets" /s /e \ No newline at end of file diff --git a/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createindex.snippet b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createindex.snippet new file mode 100644 index 0000000..e200656 --- /dev/null +++ b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createindex.snippet @@ -0,0 +1,55 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Index + mycreateindex + Creates an index. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Sample_Table + + + Columnname + Name of the column + Sample_Column + + + Uniqueness + UNIQUE or empty + UNIQUE + + + + + + +
+
+ diff --git a/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createmanytomanyreference.snippet b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createmanytomanyreference.snippet new file mode 100644 index 0000000..786dd67 --- /dev/null +++ b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createmanytomanyreference.snippet @@ -0,0 +1,122 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Many to Many Reference Table + mycreatemanyref + Creates a many to many reference table. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Invoice + + + PrimaryKey + Name of the refered key column + Id + + + Rolename + Name of the role + Customer + + + ForeignKeyPostfix + Postfix of the foreign key column + Id + + + RefSchemaName + Name of the referenced schema + dbo + + + RefTablename + Name of the referenced table + Customer + + + RefPrimaryKey + Name of the referred key column of the referenced table + Id + + + OnUpdate1 + ON UPDATE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + OnDelete1 + ON DELETE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + OnUpdate2 + ON UPDATE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + OnDelete2 + ON DELETE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + +---> [$RefSchemaName$].[$RefTablename$] +-- ------------------------------------------------------------ + +-- Create many-to-many reference table: +CREATE TABLE [$SchemaName$].[$Tablename$_$Rolename$] +( + [$Tablename$$ForeignKeyPostfix$] int NOT NULL, + [$RefTablename$$ForeignKeyPostfix$] int NOT NULL, + CONSTRAINT [PK_$Tablename$_$Rolename$] PRIMARY KEY CLUSTERED ([$Tablename$$ForeignKeyPostfix$] ASC, [$RefTablename$$ForeignKeyPostfix$] ASC) +) ON [PRIMARY] +GO + +-- Create the foreign key constraint and check it for existing data: +ALTER TABLE [$SchemaName$].[$Tablename$_$Rolename$] WITH CHECK ADD CONSTRAINT [FK_$Tablename$_$Rolename$_$Tablename$] FOREIGN KEY([$Tablename$$ForeignKeyPostfix$]) +REFERENCES [$SchemaName$].[$Tablename$] ([$PrimaryKey$]) + ON UPDATE $OnUpdate1$ + ON DELETE $OnDelete1$ +GO + +ALTER TABLE [$SchemaName$].[$Tablename$_$Rolename$] WITH CHECK ADD CONSTRAINT [FK_$Tablename$_$Rolename$_$Rolename$] FOREIGN KEY([$RefTablename$$ForeignKeyPostfix$]) +REFERENCES [$RefSchemaName$].[$RefTablename$] ([$RefPrimaryKey$]) + ON UPDATE $OnUpdate2$ + ON DELETE $OnDelete2$ +GO + +-- Enable the constraint for future data: +ALTER TABLE [$SchemaName$].[$Tablename$_$Rolename$] CHECK CONSTRAINT [FK_$Tablename$_$Rolename$_$Tablename$] +GO + +ALTER TABLE [$SchemaName$].[$Tablename$_$Rolename$] CHECK CONSTRAINT [FK_$Tablename$_$Rolename$_$Rolename$] +GO + +$end$]]> + + +
+
+ diff --git a/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createreference.snippet b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createreference.snippet new file mode 100644 index 0000000..04ad30e --- /dev/null +++ b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createreference.snippet @@ -0,0 +1,93 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Foreign Key Reference + mycreateref + Creates a foreign key reference. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Invoice + + + Rolename + Name of the role + Customer + + + ForeignKeyPostfix + Postfix of the foreign key column + Id + + + RefSchemaName + Name of the referenced schema + dbo + + + RefTablename + Name of the referenced table + Customer + + + PrimaryKey + Name of the refered key column + Id + + + OnUpdate + ON UPDATE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + OnDelete + ON DELETE action (NO ACTION | CASCADE | SET NULL | SET DEFAULT) + NO ACTION + + + +---> [$RefSchemaName$].[$RefTablename$] +-- ------------------------------------------------------------ + +-- Create an index on the foreign key column: +CREATE NONCLUSTERED INDEX [IX_$Tablename$_$Rolename$$ForeignKeyPostfix$] ON [$SchemaName$].[$Tablename$] ([$Rolename$$ForeignKeyPostfix$] ASC) +GO + +-- Create the foreign key constraint and check it for existing data: +ALTER TABLE [$SchemaName$].[$Tablename$] WITH CHECK ADD CONSTRAINT [FK_$Tablename$_$Rolename$] FOREIGN KEY([$Rolename$$ForeignKeyPostfix$]) +REFERENCES [$RefSchemaName$].[$RefTablename$] ([$PrimaryKey$]) + ON UPDATE $OnUpdate$ + ON DELETE $OnDelete$ +GO + +-- Enable the constraint for future data: +ALTER TABLE [$SchemaName$].[$Tablename$] CHECK CONSTRAINT [FK_$Tablename$_$Rolename$] +GO + +$end$]]> + + +
+
+ diff --git a/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createschema.snippet b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createschema.snippet new file mode 100644 index 0000000..c2bca77 --- /dev/null +++ b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createschema.snippet @@ -0,0 +1,43 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Schema + mycreateschema + Creates a schema. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + + + + +
+
+ diff --git a/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createstoredprocedure.snippet b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createstoredprocedure.snippet new file mode 100644 index 0000000..df38f92 --- /dev/null +++ b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createstoredprocedure.snippet @@ -0,0 +1,54 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Create Stored Procedure + mycreatestoredprocedure + Creates a stored procedure. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Procname + Name of the stored procedure + usp_NewProcedure + + + + + + +
+
+ diff --git a/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createtable.snippet b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createtable.snippet new file mode 100644 index 0000000..ac5d473 --- /dev/null +++ b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createtable.snippet @@ -0,0 +1,43 @@ + + + +
+ My Create Table + mycreatetable + Creates a table. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Sample_Table + + + + + + +
+
+ diff --git a/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createview.snippet b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createview.snippet new file mode 100644 index 0000000..43d1780 --- /dev/null +++ b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/createview.snippet @@ -0,0 +1,47 @@ + + + +
+ My Create View + mycreateview + Creates a view. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Viewname + Name of the View + Sample_View + + + + + + +
+
+ diff --git a/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/insertwithidentity.snippet b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/insertwithidentity.snippet new file mode 100644 index 0000000..652d002 --- /dev/null +++ b/Microsoft Visual Studio/Code Snippets/SQL_SSDT/My Code Snippets/insertwithidentity.snippet @@ -0,0 +1,56 @@ + + +<_locDefinition xmlns="urn:locstudio"> + <_locDefault _loc="locNone" /> + <_locTag _loc="locData">Title + <_locTag _loc="locData">Description + <_locTag _loc="locData">Author + <_locTag _loc="locData">ToolTip + + +
+ My Insert with identity statements + myinsertidentity + Insert with identity statements. + Rudi Breedenraedt + + Expansion + +
+ + + + SchemaName + Name of the schema + dbo + + + Tablename + Name of the table + Sample_Table + + + Columns + Extra columns to insert + + + + ValuesTemplate + Columns values template + + + + + + + +
+
+ diff --git a/Microsoft Visual Studio/Install on VS2017.cmd b/Microsoft Visual Studio/Install on VS2017.cmd new file mode 100644 index 0000000..db341d5 --- /dev/null +++ b/Microsoft Visual Studio/Install on VS2017.cmd @@ -0,0 +1,2 @@ +@ECHO OFF +XCOPY "%~dp0Code Snippets" "%USERPROFILE%\Documents\Visual Studio 2017\Code Snippets" /s /e \ No newline at end of file diff --git a/README.md b/README.md index 04bd0ad..737f68e 100644 --- a/README.md +++ b/README.md @@ -1 +1,4 @@ # My-Snippets + +My collection of snippets. +