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
/* | |
Snippet is nuts and bolts for creating/moving to an isolated tempdb drive. | |
After you run this, SQL Server must be restarted for it to take effect | |
*/ | |
DECLARE @DriveSizeGB INT = 40 | |
,@FileCount INT = 9 | |
,@InstanceCount TINYINT = 1 | |
,@VolumeBuffer DECIMAL(8, 2) = .8 /* Set to amount of volume TempDB can fill. */ | |
,@RowID INT | |
,@FileSize VARCHAR(10) |
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 @RowID INT; | |
DECLARE @t TABLE | |
( | |
RowID INT IDENTITY(1, 1) | |
,command VARCHAR(MAX) | |
); | |
INSERT INTO @t | |
( |
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
BEGIN | |
DECLARE @RowID INT; | |
DECLARE @Table TABLE | |
( | |
RowNum INT IDENTITY(1, 1) | |
,DBName VARCHAR(100) | |
,Command1 NVARCHAR(MAX) | |
,Command2 NVARCHAR(MAX) | |
); |
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 @WorkingSQL VARCHAR(8000) | |
,@NewPath VARCHAR(8000) = 'G:\SQL Data\' /* Root location to move files */ | |
,@TargetDatabase sysname = '%'; /* Specify a singular database, or % for All Databases */ | |
SET NOCOUNT ON; | |
/* Enable xp_cmdshell */ | |
EXEC sys.sp_configure 'Show Advanced Options', 1; | |
RECONFIGURE; |
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
SET NOCOUNT ON; | |
/* Local Vars */ | |
DECLARE @RowID_Server INT | |
,@RowID_Login INT | |
,@RowID_Option INT | |
,@NBSP CHAR(1) = CHAR(10); | |
/* Results for linked servers and currently configured options */ | |
DECLARE @LinkedServers TABLE |