Skip to content

Instantly share code, notes, and snippets.

@max-mulawa
Created April 29, 2011 09:17
Show Gist options
  • Save max-mulawa/948088 to your computer and use it in GitHub Desktop.
Save max-mulawa/948088 to your computer and use it in GitHub Desktop.
Table Variable
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
)
DECLARE @TestCollaction3 TABLE
(
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 @TestCollaction3(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 @TestCollaction3 tc3
ON tc.NameUnicode = tc3.NameUnicode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment