T-SQL - Storing and retrieving multi lingual data

In SQL Server, to store and retrieve multi lingual data :

*) We should define the column data type as NVARCHAR

*) and while inserting multi lingual data into column, column value should be prefixed with N'

For example:

--Varchar datatype does not support multi lingual data
DECLARE @multi_lingual TABLE (Data VARCHAR(200))
INSERT  @multi_lingual(data) VALUES('தமிழ்')
INSERT  @multi_lingual(data) VALUES('स्पेनिश')
INSERT  @multi_lingual(data) VALUES('中國')
SELECT * FROM @multi_lingual
--Nvarchar datatype supports multi lingual data
DECLARE @multi_lingual TABLE (Data NVARCHAR(200))
INSERT  @multi_lingual(data) VALUES(N'தமிழ்')
INSERT  @multi_lingual(data) VALUES(N'स्पेनिश')
INSERT  @multi_lingual(data) VALUES(N'中國')
SELECT * FROM @multi_lingual

See Also :

No comments: