Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@shaneis
Created October 24, 2018 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaneis/00a9ab3a8f5a7efe4a193d7186f6e9b1 to your computer and use it in GitHub Desktop.
Save shaneis/00a9ab3a8f5a7efe4a193d7186f6e9b1 to your computer and use it in GitHub Desktop.
Show there is an implicit conversion between N'' and '' types.
USE tempdb;
GO
DROP TABLE IF EXISTS dbo.NonUnicode;
DROP TABLE IF EXISTS dbo.Unicode;
CREATE TABLE dbo.NonUnicode (NU varchar(1) NOT NULL DEFAULT 'a')
CREATE TABLE dbo.Unicode (U nvarchar(1) NOT NULL DEFAULT N'a');
INSERT INTO dbo.NonUnicode (NU) DEFAULT VALUES;
INSERT INTO dbo.Unicode (U) DEFAULT VALUES;
SELECT NU FROM dbo.NonUnicode;
SELECT U FROM dbo.Unicode;
-- Turn on 'Actual Execution Plan'.
SELECT NU, U
FROM dbo.NonUnicode
JOIN dbo.Unicode
ON dbo.NonUnicode.NU = dbo.Unicode.U;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment