Skip to content

Instantly share code, notes, and snippets.

View dspolans's full-sized avatar

Dan dspolans

View GitHub Profile
@dspolans
dspolans / 1trendanalysisSSRS
Last active December 11, 2015 05:39
query based on start date and end date parameters. calculate: zscore, year totals, percent change, weighted average, averages, standard deviation, and an acceptable range for the data. used for trend analysis ssrs reports.
SELECT IBRS, IncYear, COUNT(IBRS) AS countibrs
FROM v_WIBRS
WHERE (TheDate >= @startdate) AND (TheDate <= @enddate) OR
(TheDate >= DATEADD(yy, - 1, @startdate)) AND (TheDate <= DATEADD(yy, - 1, @enddate)) OR
(TheDate >= DATEADD(yy, - 2, @startdate)) AND (TheDate <= DATEADD(yy, - 2, @enddate)) OR
(TheDate >= DATEADD(yy, - 3, @startdate)) AND (TheDate <= DATEADD(yy, - 3, @enddate)) OR
(TheDate >= DATEADD(yy, - 4, @startdate)) AND (TheDate <= DATEADD(yy, - 4, @enddate)) OR
(TheDate >= DATEADD(yy, - 5, @startdate)) AND (TheDate <= DATEADD(yy, - 5, @enddate))
GROUP BY IBRS, IncYear
@dspolans
dspolans / filename from phprunner upload
Created January 17, 2013 04:17
retrieve the file name of a file uploaded to a server folder using phprunner
left(SUBSTRING([file],CHARINDEX('searchStr":"', [file]) +12,LEN(cast([file] as varchar(100)))), len(SUBSTRING([file],CHARINDEX('searchStr":"', [file]) +12,LEN(cast([file] as varchar(100))))) - 13) as filenamefinal