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 (t: @EitanBlumin | b: eitanblumin.com) | |
| -- Date: 2020-05-31 | |
| -- Description: Collect T-SQL Error Events using an Extended Events Buffer | |
| -- The script automatically detects whether you're in an Azure SQL DB, or a regular SQL Server instance. | |
| SET NOCOUNT ON; | |
| DECLARE | |
| @SourceLinkedServer SYSNAME | |
| , @MinimumSeverity INT |
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
| CREATE TABLE RockClub ( | |
| ID INT IDENTITY(1, 1), | |
| Address_NS NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AI, | |
| Address_VS VARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AI, | |
| Address_NW NVARCHAR(128) COLLATE Latin1_General_CI_AI, | |
| Address_VW VARCHAR(128) COLLATE Latin1_General_CI_AI | |
| ) | |
| INSERT INTO RockClub (Address_NS, Address_VS, Address_NW, Address_VW) VALUES (N'Saarbrücker Straße 24, 10405 Berlin','Saarbrücker Straße 24, 10405 Berlin',N'Saarbrücker Straße 24, 10405 Berlin','Saarbrücker Straße 24, 10405 Berlin') |
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
| DECLARE @CurrDB SYSNAME = 'MyDBName' | |
| DECLARE @CMD NVARCHAR(MAX); | |
| SELECT @CMD = ISNULL(@CMD + N', | |
| ', N'') + N'(NAME = ' + QUOTENAME(name) + N' | |
| , FILENAME = ' + QUOTENAME(LEFT(physical_name, LEN(physical_name) - CHARINDEX('\', REVERSE(physical_name)) + 1) | |
| + DB_NAME(database_id) + '_' + REPLACE(NEWID(),'-','') + '.ss', N'''') | |
| + N')' |
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
| 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
| -- Author: Eitan Blumin | https://www.eitanblumin.com | |
| -- Date: 2020-02-26 | |
| -- Last Update: 2020-04-07 | |
| -- Description: Collect T-SQL Events using an Extended Events Buffer | |
| SET NOCOUNT ON; | |
| DECLARE | |
| @SourceLinkedServer SYSNAME | |
| , @MinimumDurationMilliSeconds BIGINT |
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 | https://eitanblumin.com | |
| Date Created: 2018-01-02 | |
| Last Update: 2020-03-30 | |
| Description: | |
| Fix All Orphaned Users Within Current Database, or all databases in the instance. | |
| Handles 3 possible use-cases: | |
| 1. Login with same name as user exists - generate ALTER LOGIN to map the user to the login. | |
| 2. No login with same name exists - generate DROP USER to delete the orphan user. | |
| 3. Orphan user is [dbo] - change the database owner to SA (or whatever SA was renamed to) |
-
Run from PS console:
Invoke-WebRequest -Uri powershellgallery.com/api/v2/package/sqlserver -Out D:\temp\sqlserver.zip -
Extract and save to Program Files\WindowsPowerShell\Modules\sqlserver
-
Check if Powershell is able to see it:
Get-Module -ListAvailable -
Import SqlServer module
Import-Module SqlServer
OlderNewer