Skip to content

Instantly share code, notes, and snippets.

@FilipDeVos
Created May 13, 2011 08:11
Show Gist options
  • Select an option

  • Save FilipDeVos/970185 to your computer and use it in GitHub Desktop.

Select an option

Save FilipDeVos/970185 to your computer and use it in GitHub Desktop.
Create Collation safe TempTables
CREATE TYPE NameType FROM varchar(50)
CREATE TYPE LocationType FROM varchar(50)
CREATE TABLE MoreRockStars (id int, name NameType, location LocationType)
INSERT INTO MoreRockStars VALUES (1, 'Jeff Buckley', 'Heaven')
INSERT INTO MoreRockStars VALUES (2, 'Neil Young', 'USA')
DECLARE @Name NameType,
@Location LocationType
SELECT @Name as name, @Location as information into #RockStarInfo3
INSERT INTO #RockStarInfo3 VALUES ('Jeff Buckley', 'Drowned sadly')
INSERT INTO #RockStarInfo3 VALUES ('Neil Young', 'Keeps on rocking')
SELECT *
FROM MoreRockstars s
LEFT JOIN #RockStarInfo3 i
ON s.name = i.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment