Skip to content

Instantly share code, notes, and snippets.

View rellips's full-sized avatar

Jeff Spiller rellips

View GitHub Profile
@rellips
rellips / fulljoin.sql
Last active September 11, 2016 21:32
--Example of a using a full join to compare and find missing values in two tables
--http://www.jeffspiller.net/2016/09/full-joins.html
--Copyright 2016 Jeff Spiller. All rights reserved.
--Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
create table #inventory1 (itemId_t1 int, count_t1 int);
create table #inventory2 (itemId_t2 int, count_t2 int);
--#
@rellips
rellips / unicode.sql
Last active June 11, 2016 16:48
Fun with Unicode
--More Info:http://www.jeffspiller.net/2016/06/fun-with-unicode-and-sql-server.html
--Copyright 2016 Jeff Spiller. All rights reserved.
--Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
use tempdb
create table #unicodeTest (ascii_char varchar(1),unicode_char nvarchar(1) )
insert into #unicodeTest values
('a',N'a'),
('b',N'b'),
('c',N'c')
--Step 1 Link to the Database
--More info: http://jeffspiller.net/2016/01/moving-data-with-linked-databases.html
--Copyright 2016 Jeff Spiller. All rights reserved.
--Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
Use master
if
(select count(name) from sys.servers where name='AzureTest' ) =1
begin
-- Prep - Create a table for the 'mailing list'
--More info: http://jeffspiller.net/2016/01/moving-data-with-linked-databases.html
--Copyright 2016 Jeff Spiller. All rights reserved.
--Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
USE [AdventureWorks2014]
GO
--linkedAzureServer.sql
--Example of a linked server between SQL SERVER 2014 and SQL Azure
--More info: http://jeffspiller.blogspot.com/2015/12/using-linked-server-with-azure.html
--Copyright 2015 Jeff Spiller. All rights reserved.
--Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
use master
EXEC sp_addlinkedserver
@server='AzureTest', --this is name name you use in the query
@rellips
rellips / runSQL.ps1
Last active July 9, 2016 17:52
Simple command line SQL interpreter for Microsoft SQL Server
# runSQL.ps1
# simple command line SQL interpreter for Microsoft SQL Server
# More info: http://www.jeffspiller.net/2015/12/command-line-sql-server-interpreter-sql.html
# Copyright 2015 Jeff Spiller. All rights reserved.
# Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
#############################
### config ####
#############################
$sqlServer="mypc\sqlexpress"
//Math examples
// jeffspiller.net
// Copyright 2014 Jeff Spiller. All rights reserved.
//Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
package main
import (
@rellips
rellips / gist:8661009c8d7f5d280493
Last active December 21, 2015 00:28
Variable Declarations Part 2
//variable declarations 'shortcut'
// jeffspiller.net
// Copyright 2014 Jeff Spiller. All rights reserved.
//Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
package main
//Here's how you do more than one import
import (
"fmt"
@rellips
rellips / gist:b24adc5aefd962b0b6e3
Last active December 21, 2015 00:28
Variable Declarations Part 1
//exmples of varaible declarations
// jeffspiller.net
// Copyright 2014 Jeff Spiller. All rights reserved.
//Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
package main
import "fmt"
func main() {
//The ever popular "hello world" program
// jeffspiller.net
// Copyright 2014 Jeff Spiller. All rights reserved.
//Licensed under the MIT License -- License Details at https://opensource.org/licenses/MIT
package main
import "fmt"
func main() {