Skip to content

Instantly share code, notes, and snippets.

View swaters86's full-sized avatar
🏠
Kicking ass and taking names

Steve Waters swaters86

🏠
Kicking ass and taking names
View GitHub Profile
select count (*)
--update aa
--set aa.Sist_endret = cast(aa.dato as datetime),
aa.Opprettet = cast(aa.dato as datetime)
from web.dbo.Artikkler_hode aa
left join web.dbo.Artikkler_status (nolock) bb
on (bb.Avis =aa.Avis and bb.Dato=aa.Dato and bb.Kategori=aa.Kategori and bb.Lopenr=aa.Lopenr)
where bb.Avis='DA' and bb.CreatedBy='mfxfeeder' and convert(varchar(8), aa.Opprettet, 112) > aa.dato
and aa.Dato <> '99999999'
package calculatewindchillindex;
import java.util.Scanner;
public class CalculateWindChillIndex {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// GETTING USER INPUT
@swaters86
swaters86 / FindBlockingConnections.sql
Created September 22, 2014 14:52
Gets the blocking connections for a given DB. See the comments for more information. This script was written by Mazyar Yazdini for NEWSCYCLE Solutions.
/*
First Pane
----------------------------
background - processes running in the background
runnable - processes currently running - this number shouldn't get to high
sleeping - processes that are sleeping
suspended - processed that are suspended because of the runnable processes - This number shouldn't get to high
Second Pane
@swaters86
swaters86 / CpuUsage.sql
Created September 22, 2014 14:53
Gets CPU usage for a DB server. See the comments section for more information. This script was written by Mazyar Yazdini for NEWSCYCLE Solutions.
-- Get CPU Utilization History for last 256 minutes (in one minute intervals)
-- This version works with SQL Server 2008 and SQL Server 2008 R2 only
DECLARE @ts_now bigint = (SELECT cpu_ticks/(cpu_ticks/ms_ticks)FROM sys.dm_os_sys_info);
SELECT TOP(1024) SQLProcessUtilization AS [SQL Server Process CPU Utilization],
SystemIdle AS [System Idle Process],
100 - SystemIdle - SQLProcessUtilization AS [Other Process CPU Utilization],
DATEADD(ms, -1 * (@ts_now - [timestamp]), GETDATE()) AS [Event Time]
FROM (
SELECT record.value('(./Record/@id)[1]', 'int') AS record_id,
http://www.troyrecord.com/new-york-troy
Navigation Profile: 4004092
<!-- exec custom.dbo.GetStoriesForTop @Sites='TR,ZZ', @DataSite='TR', @Count=5, @Days=30, @ExcludeGUIDS = '', @Position='sectiontop5', @DynamicRootProfile = 4004124, @PublicationTaxonomy = 102413, @GeoTaxonomy = 'N/A', @Frontpage = 0; -->
http://www.troyrecord.com/news
set clustercode=%1
set environments_string=%2
for /f "tokens=*" %%a in (%environments_string%) do (
set environments=%%a
)
/*
truncate table shared.dbo.cachestorage_JRC_BM
update shared.dbo.CacheStorage_JRC_BM_permanent set [Timestamp] = DATEADD(d, -30, getdate())
truncate table shared.dbo.cachestorage_JRC_DC
update shared.dbo.CacheStorage_JRC_DC_permanent set [Timestamp] = DATEADD(d, -30, getdate())
truncate table shared.dbo.cachestorage_JRC_DF
update shared.dbo.CacheStorage_JRC_DF_permanent set [Timestamp] = DATEADD(d, -30, getdate())
truncate table shared.dbo.cachestorage_JRC_DL
update shared.dbo.CacheStorage_JRC_DL_permanent set [Timestamp] = DATEADD(d, -30, getdate())
/*
============ Start 3 ===================
truncate table shared.dbo.cachestorage_mn1_LA
update shared.dbo.CacheStorage_MN1_LA_permanent
set [Timestamp] = DATEADD(d, -30, getdate())
@swaters86
swaters86 / Update last modified and created date-time values for articles
Created October 3, 2014 17:49
This script will update the last modified and created date-time values in the artikkler_status table for stories so PBS tags using a created or last modified sorting parameter will sort the articles correctly.
/*
update aa
set aa.Sist_endret = cast(aa.dato as datetime),
aa.Opprettet = cast(aa.dato as datetime)
*/
select count (*)
from web.dbo.Artikkler_hode aa
left join web.dbo.Artikkler_status (nolock) bb
on (bb.Avis =aa.Avis and bb.Dato=aa.Dato and bb.Kategori=aa.Kategori and bb.Lopenr=aa.Lopenr)
where bb.Avis='WC' and bb.CreatedBy='mfxfeeder' and convert(varchar(8), aa.Opprettet, 112) > aa.dato
@echo off
set clustercode=%1
set environments_string=%2
set sitecodes_string=%3
for /f "tokens=*" %%a in (%environments_string%) do (