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
CREATE TABLE #counts | |
( | |
table_name varchar(255), | |
row_count int | |
) | |
EXEC sp_MSForEachTable @command1= | |
'INSERT #counts (table_name, row_count) SELECT ''?'', COUNT(*) FROM ?' | |
SELECT table_name, row_count FROM #counts ORDER BY table_name, row_count DESC | |
DROP TABLE #counts |
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
<html> | |
<head> | |
<script type="text/javascript" src="jquery-3.3.1.js"></script> | |
<script type="text/javascript"> | |
$.ajaxSetup ({ | |
cache: false // Disable caching of AJAX responses | |
}); | |
$(document).ready(function() { |
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
SELECT CONCAT('ALTER DATABASE [', name, '] SET READ_WRITE WITH NO_WAIT') | |
FROM sys.databases where is_read_only=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
IF NOT EXISTS (SELECT TOP 1 1 FROM sys.databases WHERE name = 'K2Categories') | |
BEGIN | |
CREATE DATABASE [K2Categories] ON | |
(FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\K2Categories.mdf') | |
, (FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\K2Categories_log.LDF') | |
FOR ATTACH; | |
END | |
GO | |
IF NOT EXISTS (SELECT TOP 1 1 FROM sys.databases WHERE name = 'K2Dependencies') |
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
SELECT D.name AS DatabaseName | |
, D.collation_name | |
FROM sys.databases AS D | |
WHERE D.Name like 'K2%' |
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
SELECT CONVERT (varchar, SERVERPROPERTY('collation')) as 'SQL Server Collation'; |
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
$newConnection = "Data Source=DLX;Initial Catalog=K2;Integrated Security=True" | |
$installKey = Get-ItemProperty "HKLM:\SOFTWARE\SourceCode\blackpearl\blackpearl Core" | |
$configPath = $installKey.InstallDir + "Setup\Configuration.config" | |
$xml = New-Object XML | |
$xml.Load($configPath) | |
$connectionNode = $xml.configuration.configurationdatabase.add | Where-Object { $_.key -eq 'connectionString' } | |
$connectionNode.value = $newConnection |
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 master; | |
GO | |
IF (select Count(*) from sys.symmetric_keys where name like '%DatabaseMasterKey%') = 0 | |
BEGIN | |
CREATE MASTER KEY ENCRYPTION BY PASSWORD='P@ssw0rd'; | |
END | |
GO | |
IF (select Count(*) from sys.certificates where name = 'TdeCertificate') = 0 | |
BEGIN | |
CREATE CERTIFICATE TdeCertificate WITH SUBJECT='TDE Certificate' |
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
--Be sure to select master DB and click "New Query" before runnig this | |
SELECT [name], is_master_key_encrypted_by_server, is_encrypted | |
FROM master.sys.databases | |
GO | |
--View the symmetric keys | |
SELECT | |
[name] | |
, [principal_id] |
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
SELECT Name, Description FROM fn_helpcollations() |
OlderNewer