Skip to content

Instantly share code, notes, and snippets.

@max-mulawa
Created April 29, 2011 09:08
Show Gist options
  • Save max-mulawa/948079 to your computer and use it in GitHub Desktop.
Save max-mulawa/948079 to your computer and use it in GitHub Desktop.
Create Temporary Tables
USE DatabaseWithPolishCollation
GO
IF OBJECT_ID('TestCollaction','U') IS NOT NULL
DROP TABLE TestCollaction
CREATE TABLE TestCollaction
(
Id Int PRIMARY KEY,
Name VARCHAR(20) NOT NULL,
NameUnicode NVARCHAR(20) NOT NULL
)
IF OBJECT_ID('tempdb..#TestCollaction2') IS NOT NULL
DROP TABLE #TestCollaction2
CREATE TABLE #TestCollaction2
(
Id Int PRIMARY KEY,
Name VARCHAR(20) NOT NULL,
NameUnicode NVARCHAR(20) NOT NULL
)
INSERT INTO TestCollaction(Id, Name, NameUnicode)
SELECT 1, 'Test 1', N'Test 1 Unicode'
UNION ALL
SELECT 2, 'Test 2', N'Test 2 Unicode'
INSERT INTO #TestCollaction2(Id, Name, NameUnicode)
SELECT 1, 'Test 1', N'Test 1 Unicode'
UNION ALL
SELECT 2, 'Test 2', N'Test 2 Unicode'
SELECT *
FROM TestCollaction tc
INNER JOIN #TestCollaction2 tc2
ON tc.NameUnicode = tc2.NameUnicode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment