This file contains hidden or 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
| /* | |
| Author: Eitan Blumin | @EitanBlumin, https://www.eitanblumin.com | |
| Create Date: 2016-06-03 | |
| Last Update: 2020-05-19 | |
| Description: | |
| This procedure creates a partitioned view on top of identically-named tables that exist in multiple databases. | |
| Parameters: | |
| @DBNamePattern - Database name pattern to use for filtering the relevant databases |
This file contains hidden or 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
| BEGIN TRANSACTION; | |
| UPDATE dbo.t WITH (UPDLOCK, SERIALIZABLE) SET val = @val WHERE [key] = @key; | |
| IF @@ROWCOUNT = 0 | |
| BEGIN | |
| INSERT dbo.t([key], val) VALUES(@key, @val); | |
| END | |
| COMMIT TRANSACTION; |
This file contains hidden or 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
| SET ANSI_NULLS ON | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| CREATE PROCEDURE [dbo].[gsp_generate_table_desc] | |
| @tablename SYSNAME, | |
| @db_name SYSNAME, | |
| @create_with_identity BIT = 1, | |
| @table_prefix VARCHAR(20) = '', | |
| @Additional_attr VARCHAR(1000) = '', |
This file contains hidden or 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 master | |
| DBCC SQLPERF('sys.dm_os_latch_stats',CLEAR); | |
| DBCC SQLPERF('sys.dm_os_wait_stats',CLEAR); | |
| CHECKPOINT | |
| DBCC DROPCLEANBUFFERS | |
| DBCC FREEPROCCACHE WITH NO_INFOMSGS; | |
| DBCC FREESYSTEMCACHE ('ALL') WITH MARK_IN_USE_FOR_REMOVAL | |
| USE CCR; | |
| GO |
This file contains hidden or 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
| /* | |
| ///////////// | |
| ////ERROR//// | |
| ///////////// | |
| All error will be listed if object is broken | |
| */ | |
| DECLARE @AllObjectName TABLE ( | |
| OrdinalNo INT IDENTITY | |
| ,ObjectName NVARCHAR(MAX) | |
| ,ObjectType NVARCHAR(MAX) |
This file contains hidden or 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
| Information from https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file : | |
| Use any character in the current code page for a name, including Unicode | |
| characters and characters in the extended character set (128–255), except | |
| for the following: | |
| - The following reserved characters: | |
| < (less than) | |
| > (greater than) |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <opml version="1.0"> | |
| <head> | |
| <title>Bert's mostly SQL subscriptions in feedly Cloud</title> | |
| </head> | |
| <body> | |
| <outline text="Marketing" title="Marketing"> | |
| <outline type="rss" text="Signal v. Noise" title="Signal v. Noise" xmlUrl="https://signalvnoise.com/posts.rss" htmlUrl="https://m.signalvnoise.com"/> | |
| <outline type="rss" text="Austin Kleon" title="Austin Kleon" xmlUrl="http://feeds2.feedburner.com/AustinKleon" htmlUrl="https://austinkleon.com"/> |
This file contains hidden or 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
| WITH Top1Query | |
| AS (SELECT TOP 1 | |
| dest.text, | |
| deqp.query_plan | |
| FROM sys.dm_exec_query_stats AS deqs | |
| CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest | |
| CROSS APPLY sys.dm_exec_query_plan(deqs.plan_handle) AS deqp | |
| ORDER BY deqs.execution_count DESC) | |
| SELECT TOP 3 | |
| tq.text, |
This file contains hidden or 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
| /************************************************************ | |
| * Code formatted by SoftTree SQL Assistant © v11.0.35 | |
| * Time: 12/29/2020 12:42:58 AM | |
| ************************************************************/ | |
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| CREATE FUNCTION [dbo].[XMLTable] |