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
| /* | |
| Descriptions: reference for all the xml shapping I've learned | |
| Author: Mattehw Naul | |
| Explanation: | |
| for each person do a correlated query for phone numbers, | |
| format them mixing attributes and element values, | |
| serialize to xml with "TYPE" so that we return on column of type XML root tag (phonelist) | |
| name the cross apply result, | |
| when phonelist(col) is null add nil phonelist node |
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
| /* | |
| Description: A T-SQL implementation of Sierpinski's Triangles, just to see if I could do it. | |
| Requires: SQL Server 2012 | |
| Inspired by: Alastair Aitchison SQLCLR implementation http://alastaira.wordpress.com/2012/03/06/drawing-fractals-with-sql-server-spatial/ | |
| Author: Matthew Naul | |
| */ | |
| DECLARE | |
| @itrations INT = 12, | |
| @seed geometry = geometry::STGeomFromText ('LINESTRING (9 12, 0 0, 18 0, 9 12)',0); | |
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 | |
| name | |
| -- added Days Back to use a fitler aginst the user input | |
| ,DATEDIFF(DAY,CONVERT(DATE, calc.run_date),GETDATE()) AS DaysBack | |
| ,CONVERT( DATETIME, calc.run_date + SPACE(1) + calc.run_time) AS start_time | |
| -- using seconds here as I had a problem with times over 24 hrs | |
| ,DATEADD(SECOND, jh.run_duration, CONVERT( DATETIME, calc.run_date + SPACE(1) + calc.run_time)) AS end_time | |
| ,run_status | |
| ,instance_id | |
| FROM msdb.dbo.sysjobhistory jh |
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
| { | |
| function extractOptional(optional, index) { | |
| return optional ? optional[index] : null; | |
| } | |
| function optionalList(value) { | |
| return value !== null ? value : []; | |
| } | |
| } |
NewerOlder