Skip to content

Instantly share code, notes, and snippets.

mjswart

Block or report user

Report or block mjswart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View "Invalid Object" repro
create procedure s_test
as
select 1 as one
into #ONE;
select * from #ONE;
go
-- Get estimated plan for the following:
-- highlight the next line in SSMS and press CTRL+L
@mjswart
mjswart / RugTriangles
Last active Apr 6, 2018
Count the triangles in the rug
View RugTriangles
<!DOCTYPE HTML>
<html>
<body>
<script>
function IsConnected(x1, y1, x2, y2) {
return (x1 == x2) ||
(y1 == y2) ||
(Math.abs(x1-x2) == Math.abs(y1-y2) && ((x1+y1)%2) == 0);
}
View xml example
declare @xml xml = N'
<root>
<blat x="abc1">asdf</blat>
<blat x="abc2">asdf</blat>
<blat x="def">asdf</blat>
<blat x="def">asdf</blat>
<blat y="abc">asdf</blat>
</root>';
select nodes.n.query('.')
@mjswart
mjswart / ssms_color_grid.sql
Created May 5, 2017
SQL Server Management Studio Colors for the Spatial Results Tab
View ssms_color_grid.sql
use tempdb
go
create table #polygons
(
polygonShape varchar(max),
color int check (color between 1 and 100),
intensity int check (intensity between 1 and 5)
);
View Polly.sql
use tempdb
go
if (object_id('paths') is not null) drop table paths;
if (object_id('colorMapping') is not null) drop table colorMapping;
if (object_id('polygons') is not null) drop table polygons;
create table paths
(
color char(7),
@mjswart
mjswart / d2l.sql
Created May 1, 2017
Desire2Learn logo
View d2l.sql
use tempdb
go
if object_id('#polygons') is not null
drop table #polygons;
go
create table #polygons
(
polygonShape varchar(max),
color int check (color between 1 and 100),
@mjswart
mjswart / SSB.sql
Last active Apr 22, 2018
say can you see?
View SSB.sql
use tempdb
go
declare @xoffset numeric(7,3) = 90;
declare @yoffset numeric(7,3) = -164;
declare @scale_star numeric(7,3) = 250;
declare @scale_x numeric(7,3) = 250;
declare @scale_y numeric(7,3) = -210;
declare @stars_xml xml;
@mjswart
mjswart / BDay.sql
Created Apr 18, 2017
Guess whose birthday it is!
View BDay.sql
use tempdb
go
create table #polygons
(
polygonShape varchar(max),
color int check (color between 1 and 100),
intensity int check (intensity between 1 and 5)
);
You can’t perform that action at this time.