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 FUNCTION dbo.split( | |
@delimited NVARCHAR(MAX), | |
@delimiter NVARCHAR(100) | |
) RETURNS @t TABLE (id INT IDENTITY(1,1), val NVARCHAR(MAX)) | |
AS | |
BEGIN | |
DECLARE @xml XML | |
SET @xml = N'<t>' + REPLACE(@delimited,@delimiter,'</t><t>') + '</t>' | |
INSERT INTO @t(val) | |
SELECT r.value('.','varchar(MAX)') as item |
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 DatabaseName --Enter the name of the database you want to reindex | |
DECLARE @TableName varchar(255) | |
DECLARE TableCursor CURSOR FOR | |
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 sqltext.TEXT, | |
req.session_id, | |
req.status, | |
req.command, | |
req.cpu_time, | |
req.total_elapsed_time | |
FROM sys.dm_exec_requests req | |
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext |
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 dbschemas.[name] as 'Schema', | |
dbtables.[name] as 'Table', | |
dbindexes.[name] as 'Index', | |
indexstats.alloc_unit_type_desc, | |
indexstats.avg_fragmentation_in_percent, | |
indexstats.page_count | |
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS indexstats | |
INNER JOIN sys.tables dbtables on dbtables.[object_id] = indexstats.[object_id] | |
INNER JOIN sys.schemas dbschemas on dbtables.[schema_id] = dbschemas.[schema_id] | |
INNER JOIN sys.indexes AS dbindexes ON dbindexes.[object_id] = indexstats.[object_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
DECLARE @Search VARCHAR(100) | |
set @Search='CutoffDateTime' | |
SELECT o.name[Object Name], | |
CASE O.xtype WHEN 'P' THEN 'Stored procedure' | |
WHEN 'RF' THEN 'Replication filter stored procedure' | |
WHEN 'TR' THEN 'Trigger' | |
WHEN 'FN' THEN 'Scalar function' | |
WHEN 'IF' THEN 'In-lined table-function' | |
WHEN 'IT' THEN 'Internal table' | |
WHEN 'TF' THEN 'Table 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
-- ================================================ | |
-- Template generated from Template Explorer using: | |
-- Create Procedure (New Menu).SQL | |
-- | |
-- Use the Specify Values for Template Parameters | |
-- command (Ctrl-Shift-M) to fill in the parameter | |
-- values below. | |
-- | |
-- This block of comments will not be included in | |
-- the definition of the procedure. |
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
<script type="text/javascript"> | |
function Validate() | |
{ | |
var element | |
element = document.getElementById("<%=ddlStartMonth.ClientID%>"); | |
var StartMonth = element.options[element.selectedIndex].text; | |
element = document.getElementById("<%=ddlStartYear.ClientID%>"); | |
var StartYear = element.options[element.selectedIndex].text; | |
element = document.getElementById("<%=ddlEndMonth.ClientID%>"); | |
var EndMonth = element.options[element.selectedIndex].text; |
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
function ManagerSetup() { | |
var lbDivisions = document.getElementById("< %=lstAMGRight.ClientID%>"); | |
var lbManagersSelect = document.getElementById("< %=lstMGRRight.ClientID%>"); | |
var lbManagersNotSelect = document.getElementById("< %=lstMGRLeft.ClientID%>"); | |
//lbManagersNotSelect.options.length = 0; | |
lbManagersSelect.options.length = 0; | |
//Set all disabled, then enabled those in divisions | |
for (var j = 0; j < lbManagersNotSelect.options.length; j++) { |
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
function InsertRows() { | |
var intRowCount = Number(document.getElementById("RowCount").value); | |
var BeginRow = intRowCount+1; | |
var EndRow = intRowCount + 5; | |
for (var x = BeginRow; x <= EndRow; x++) { | |
var table = document.getElementById("TableBody"); | |
var LastRow = table.rows(x - 1); | |
var row = table.insertRow(x); | |
var cell1 = row.insertCell(0); | |
var cell2 = row.insertCell(1); |