Questions tagged [unicode]

103 questions
53
votes
2 answers

How to create Unicode parameter and variable names

All of this works: CREATE DATABASE [¯\_(ツ)_/¯]; GO USE [¯\_(ツ)_/¯]; GO CREATE SCHEMA [¯\_(ツ)_/¯]; GO CREATE TABLE [¯\_(ツ)_/¯].[¯\_(ツ)_/¯]([¯\_(ツ)_/¯] NVARCHAR(20)); GO CREATE UNIQUE CLUSTERED INDEX [¯\_(ツ)_/¯] ON…
Brent Ozar
  • 42,296
  • 45
  • 201
  • 356
34
votes
1 answer

How do I set a SQL Server Unicode / NVARCHAR string to an emoji or Supplementary Character?

I want to set a Unicode string variable to particular character based on its Unicode code point. I want to use a code point beyond 65535, but the SQL Server 2008 R2 database has a collation of SQL_Latin1_General_CP1_CI_AS. According to Microsoft's…
Riley Major
  • 1,831
  • 1
  • 17
  • 30
26
votes
1 answer

Why does searching for LIKE N'%�%' match any Unicode character and = N'�' match many?

DECLARE @T TABLE( Col NCHAR(1)); INSERT INTO @T VALUES (N'A'), (N'B'), (N'C'), (N'Ƕ'), (N'Ƿ'), (N'Ǹ'); SELECT * FROM @T WHERE Col LIKE N'%�%' Returns Col A B C Ƕ Ƿ Ǹ SELECT…
Martin Smith
  • 80,333
  • 15
  • 230
  • 323
20
votes
2 answers

Accent Sensitive Sort

Why do these two SELECT statements result in a different sort order? USE tempdb; CREATE TABLE dbo.OddSort ( id INT IDENTITY(1,1) PRIMARY KEY , col1 NVARCHAR(2) , col2 NVARCHAR(2) ); GO INSERT dbo.OddSort (col1, col2) VALUES (N'e',…
Aram
  • 203
  • 1
  • 5
20
votes
2 answers

Can't update "CO2" to "CO₂" in table row

Given this table: CREATE TABLE test ( id INT NOT NULL, description NVARCHAR(100) COLLATE Modern_Spanish_CI_AS NOT NULL ); INSERT INTO test (id, description) VALUES (1, 'CO2'); I've realised I can't fix a typographic issue: SELECT * FROM…
Álvaro González
  • 1,059
  • 4
  • 16
  • 30
20
votes
2 answers

Why these characters are all equal in SQL Server?

I just don't get it. See this SQL query: select nchar(65217) -- ﻁ select nchar(65218) -- ﻂ select nchar(65219) -- ﻃ select nchar(65220) -- ﻄ if nchar(65217) = nchar(65218) print 'equal' if nchar(65217) = nchar(65219) print 'equal' if…
Saeed Neamati
  • 1,317
  • 2
  • 16
  • 28
19
votes
1 answer

Querying non-ASCII rows from Postgres

Does [:ascii:] class work in Postgres at all? It is not listed in their help, however I see examples in the web which utilize it. I have a UTF-8 database, where collation and c_type are en_US.UTF-8, and Postgres version is 9.6.2. When I search for…
Suncatcher
  • 357
  • 2
  • 4
  • 12
18
votes
5 answers

Why does the varchar datatype allow unicode values?

I have a table with a varchar column. It is allowing Trademark(™), copyright(©) and other Unicode characters as shown below. Create table VarcharUnicodeCheck ( col1 varchar(100) ) insert into VarcharUnicodeCheck (col1) values ('MyCompany') insert…
Shiva
  • 765
  • 3
  • 6
  • 17
18
votes
2 answers

Latin1_General_BIN performance impact when changing the database default collation

I have set the database collation to Latin1_General_BIN, to make string comparisons case-sensitive. Will this have an impact on performance? Will it have any impact on DML or DDL operations in the database? The database already exists with tables in…
17
votes
4 answers

How To Strip Hebrew Accent Marks

I need a Char Encoding Trick to Strip Hebrew Accent Marks. Sample Before בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ Sample After בראשית ברא אלהים את השמים ואת הארץ
Decrypted
  • 273
  • 1
  • 6
15
votes
4 answers

Detect if any values in NVARCHAR columns are actually unicode

I have inherited some SQL Server databases. There is one table (I'll call "G"), with about 86.7 million rows, and 41 columns wide, from a source database (I'll call "Q") on SQL Server 2014 Standard that gets ETL'd over to a target database (I'll…
John G Hohengarten
  • 663
  • 1
  • 5
  • 18
14
votes
1 answer

Why does a comparison between 'tr' & 'tR' fail on a SQL Server with Vietnamese_CI_AI collation?

There seems to be something special about 'tR' in Vietnamese collation. Appreicate if anyone who knows about it can explain in simple terms. This issue was discovered during the installation of our product on a "Vietnamese" collated SQL Server. One…
12
votes
2 answers

When `nvarchar/nchar` is going to be used with SQL Server 2019?

With SQL Server 2019 Microsoft introduces UTF-8 support for CHAR and VARCHAR data types and says: This feature may provide significant storage savings, depending on the character set in use. For example, changing an existing column data type…
gotqn
  • 3,709
  • 10
  • 42
  • 77
12
votes
1 answer

Text string stored in SQLite Integer column?

I'm a database novice looking at an SQLite database which appears to be storing text in an integer column. Here's an example session at the sqlite3 command line: sqlite> .schema mytable CREATE TABLE mytable ( id integer primary key,…
igal
  • 335
  • 1
  • 2
  • 9
9
votes
2 answers

Why does Oracle use a different byte length than java for the supplementary unicode character chipmunk?

I have java code trimming a UTF-8 string to the size of my Oracle (11.2.0.4.0) column which ends up throwing an error because java and Oracle see the string as different byte lengths. I've verified my NLS_CHARACTERSET parameter in Oracle is…
agradl
  • 211
  • 2
  • 6
1
2 3 4 5 6 7