barlop
barlop

Reputation: 13790

How do I write a create table query that makes a unicode supporting table, in SMSS?

I have SMSS Microsoft SQL Server Management Studio 17.3 Select @@VERSION shows Microsoft SQL Server 2014 - 12.0.2269.0 (X64)

Here are the queries, as you see from the image, the hebrew characters are not showing up in the table.

DROP TABLE ABCD
CREATE TABLE ABCD(AAA INT, BBB VARCHAR(100))
INSERT INTO ABCD(AAA,BBB) VALUES(1,'אאא')

select * from ABCD

select * from ABCD where BBB LIKE '%א%'

enter image description here

Upvotes: 1

Views: 77

Answers (1)

John Cappelletti
John Cappelletti

Reputation: 82000

NVARCHAR is is what you are looking for

I should add the N indicates a unicode string as explained here

DROP TABLE ABCD
CREATE TABLE ABCD(AAA INT, BBB NVARCHAR(100))
INSERT INTO ABCD(AAA,BBB) VALUES(1,N'אאא')

select * from ABCD

select * from ABCD where BBB LIKE N'%א%'

Returns

AAA BBB
1   אאא


AAA BBB
1   אאא

Upvotes: 4

Related Questions