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 msdb ; | |
| GO | |
| EXEC dbo.sp_start_job N'The name of the job here'; | |
| 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
| SET NOCOUNT ON | |
| DECLARE @isRunning BIT | |
| DECLARE @xp_results TABLE (job_id UNIQUEIDENTIFIER NOT NULL, | |
| last_run_date INT NOT NULL, | |
| last_run_time INT NOT NULL, | |
| next_run_date INT NOT NULL, | |
| next_run_time INT NOT NULL, | |
| next_run_schedule_id INT NOT NULL, | |
| requested_to_run INT NOT NULL, -- BOOL | |
| request_source INT NOT NULL, |
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
| #http://www.brangle.com/wordpress/2009/08/combine-join-two-text-files-using-powershell/ |
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 @JOB_NAME SYSNAME = N'Daily update of indexes & statistics'; | |
| IF NOT EXISTS( | |
| select 1 | |
| from msdb.dbo.sysjobs_view job | |
| inner join msdb.dbo.sysjobactivity activity on job.job_id = activity.job_id | |
| where | |
| activity.run_Requested_date is not null | |
| and activity.stop_execution_date is null | |
| and job.name = @JOB_NAME |
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 DER_CommProg; | |
| GO | |
| CREATE TABLE #functionInfo | |
| ( | |
| ID BIGINT NOT NULL | |
| ,Name VARCHAR(200) NULL | |
| ,[SchemaName] VARCHAR(200) NULL | |
| ,[Description] VARCHAR(200) NULL | |
| ,[Definition] VARCHAR(MAX) NULL |
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
| /*============================================================================ | |
| Script to report Memory usage details of a SQL Server instance | |
| Author: Sakthivel Chidambaram, Microsoft http://blogs.msdn.com/b/sqlsakthi | |
| Date: June 2012 | |
| Version: V2 | |
| V1: Initial Release | |
| V2: Added PLE, Memory grants pending, Checkpoint, Lazy write,Free list counters |
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
| SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition') |
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 <REPLACE WITH DATABASE NAME> | |
| SELECT | |
| foreignKeyConstraintObject.Name as ForeignKeyConstraint | |
| ,foreignKeySchema.Name as ForeignKeySchema | |
| ,foreignKeyTable.Name as ForeignKeyTable | |
| ,foreignKeyColumn.Name as FoeignKeyName | |
| ,referencedSchema.Name as ReferencedSchema | |
| ,referencedTable.Name as ReferencedTable | |
| ,referencedColumn.Name as ReferencedColumn |
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 <REPLACE WITH DATABASE NAME> | |
| CREATE TABLE #tablesOfInterest (TableName VARCHAR(2000)) | |
| INSERT INTO #tablesOfInterest | |
| SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES | |
| WHERE TABLE_NAME | |
| IN ('table1' | |
| ,'table2' | |
| ) |
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
| open System.IO | |
| let lines path = | |
| System.IO.File.ReadAllLines(path) | |
| let writeFile lines path = | |
| System.IO.File.Delete(path) | |
| System.IO.File.AppendAllLines(path, lines) | |
| let replaceNulls path = | |
| let origFileNameAndExtension = System.IO.Path.GetFileName(path) |