This file contains 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
/*****************************************************************************************************************************************/ | |
/**** SHRINK LOG FILES *******************************************************************************************************************/ | |
/*****************************************************************************************************************************************/ | |
DECLARE @sql VARCHAR(max) = '' | |
SELECT @sql += CONCAT('USE [', DB_NAME([mf].[database_id]), ']', CHAR(13), CHAR(10), 'DBCC SHRINKFILE (''', [mf].[name], ''', 1) WITH NO_INFOMSGS;', CHAR(13), CHAR(10)) | |
FROM sys.[master_files] AS [mf] | |
WHERE [mf].[type_desc] = 'LOG' |
This file contains 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
@rem remove last commit and destroy it | |
git reset --hard HEAD~1 | |
@rem remove last commit and edit it | |
git reset HEAD~1 |
This file contains 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
@REM https://docs.nuget.org/consume/command-line-reference | |
@call "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat" | |
nuget locals all -clear |
This file contains 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
@REM Make sure you are in the root folder of the git repo that you wish to move the code to | |
git checkout master | |
git remote add r1remote **url-of-repo1** | |
git fetch r1remote | |
git merge r1remote/master --allow-unrelated-histories | |
git remote rm r1remote |
This file contains 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
public partial class MyContextReadOnly : MyContext | |
{ | |
private readonly string _connectionString = null; | |
public MyContextReadOnly(DbContextOptions<MyContextReadOnly> options) : base(options) | |
{ | |
var sqlServerOptionsExtension = options.FindExtension<SqlServerOptionsExtension>()!; | |
_connectionString = sqlServerOptionsExtension?.ConnectionString!; | |
} |
This file contains 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
public class NamedParameter | |
{ | |
public string Name { get; set; } = null!; | |
public object Value { get; set; } | |
public NamedParameter(string name, object value) | |
{ | |
if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } | |
if (value == null) { throw new ArgumentNullException(nameof(value)); } | |
Name = name; | |
Value = value; |
This file contains 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
/** | |
Copyright (c) Red Gate Software Ltd 2021 | |
All rights Reserved. Use of this code is subject to the terms of a license agreement with Red Gate Software Limited. | |
This is a temporary batch for creating such things as table variables, temporary tables or anything else that needs a column list. | |
For more info, see https://www.red-gate.com/hub/product-learning/sql-prompt/building-reusable-table-build-scripts-using-sql-prompt | |
**/ |
This file contains 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 DUI pattern to mimic merge */ | |
DELETE aq | |
FROM dbo.AppQuestionResponse aq | |
LEFT JOIN @QuestionAnswers aqtt ON aq.appQuestionID = aqtt.QuestionID | |
WHERE aq.policyID = @policyID | |
AND aqtt.QuestionID IS NULL | |
UPDATE aq | |
SET aq.response = aqtt.answer, aq.comment = aqtt.Explanation |
This file contains 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
#Requires -RunAsAdministrator | |
$osInfo = Get-WmiObject -Class Win32_OperatingSystem | |
# $osInfo | Format-List * | |
if ($osInfo.ServicePackMajorVersion -gt 0) { | |
$spInfo = " SP $($osInfo.ServicePackMajorVersion).$($osInfo.ServicePackMinorVersion))" | |
} | |
Write-Output "Running on $($osInfo.PSComputerName) ($($osInfo.Caption) Build $($osInfo.properties["BuildNumber"].Value)$spInfo)" |
This file contains 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 @job_name sysname, | |
@job_id UNIQUEIDENTIFIER; | |
DECLARE inject_jobs_cursor CURSOR FAST_FORWARD | |
FOR ( | |
SELECT [j].[name], [j].[job_id] | |
FROM msdb.dbo.[sysjobs] AS [j] | |
WHERE [j].[enabled] = 1 | |
AND NOT EXISTS ( | |
SELECT * FROM [msdb].[dbo].[sysjobsteps] AS [s2] WHERE [s2].[job_id] = [j].[job_id] AND [s2].[step_name] = 'CHECK AG' |
NewerOlder