Questions tagged [nvarchar]

Variable-length character data type in Transact-SQL.

Variable-length character data type in Transact-SQL. More info: https://msdn.microsoft.com/en-us/library/ms186939.aspx.

483 questions
7
votes
2 answers

Converting nvarchar(4000) to nvarchar(max)

We have a few tables in our SQL Server (2005 & 2008) database with columns defined as nvarchar(4000). We sometimes need to be able to store more data than that and consider to use nvarchar(max) instead. Now to the questions. Are there any…
Johan Hammar
  • 177
  • 1
  • 11
7
votes
2 answers

Retrieving Arabic text from MSSQL NVarchar column

I am making a Library Management System, I am trying to add arabic support in my project but I am facing difficulties as follows, when inserting data in SQL through Query i.e Insert into book_info values(25, N'جاوا',…
MMujtabaRoohani
  • 483
  • 4
  • 19
6
votes
1 answer

Oracle, utf-8, NVARCHAR2, and a lot of confusion

I have the following "translation" table in an oracle 10g database: ID VARCHAR2(100 BYTE) LANGUAGE CHAR(2 BYTE) COUNTRY CHAR(2 BYTE) TRANSLATION NVARCHAR2(2000 CHAR) TRACK_TIMESTAMP DATE TRACK_USER VARCHAR2(2000 BYTE) When I try to do…
testing123
  • 11,367
  • 10
  • 47
  • 61
6
votes
1 answer

When is nvarchar(Max) = nvarchar(4000)?

There are multiple posts on both SO and other sites which clearly state that the maximum length of nvarchar(max) is 2GB. However, I see also much confusion in both internet and real life that it actually is 8000/4000 in Unicode. I would like to know…
George Menoutis
  • 6,894
  • 3
  • 19
  • 43
6
votes
6 answers

Is there a reason why I shouldn't use NVARCHAR in Sql Server?

I'm designing a database scheme right now and I figure just to be safe I should use nvarchar for my textual column's datatypes (for unicode support). While I don't expect non-english text I figure it would be better to have support it from the…
mmcdole
  • 91,488
  • 60
  • 186
  • 222
6
votes
2 answers

SQL LIKE Operator doesn't work with Asian Languages (SQL Server 2008)

Dear Friends, I've faced with a problem never thought of ever. My problem seems too simple but I can't find a solution to it. I have a sql server database column that is of type NVarchar and is filled with standard persian characters. when I'm…
Farshid
  • 5,134
  • 9
  • 59
  • 87
6
votes
4 answers

Does `sp_executesql` really accepts the `nvarchar(max)` argument?

Summary: The EXEC sp_executesql @code fails for the content longer than 4000 in the @code, but the @code is not truncated to 4000 unicode characters. I am observing the problem on SQL Server 2014 Developer Edition. More details: my SQL installation…
pepr
  • 20,112
  • 15
  • 76
  • 139
6
votes
1 answer

SQL Inserting multilingual data - loses diacritic marks etc

Inserting multilingual data into a SQL 2008 database (nvarchar field) I notice that it seems to lose some special character marks. e.g. INSERT INTO [dbName].[dbo].[tbl_Question_i18n] ([QuestionId] ,[LanguageId] …
zombiejojo
  • 75
  • 1
  • 6
6
votes
6 answers

Convert NVARCHAR to DATETIME in SQL Server 2008

In my table LoginDate 2013-08-29 13:55:48 The loginDate column's datatype is nvarchar(150) I want to convert the logindate column into date time format using SQL command Expected result. LoginDate 29-08-2013 13:55:48
user2617053
  • 323
  • 3
  • 5
  • 13
6
votes
1 answer

What is the biggest data type to use as a local variable in a stored procedure?

I have the next issue: --DECLARE @TEST NVARCHAR(MAX) --DECLARE @TEST2 NVARCHAR(MAX) DECLARE @TEST NTEXT DECLARE @TEST2 NTEXT NVARCHAR(MAX) is to small for the amount of text in need to put when executing a stored procedure, also, TEXT, NTEXT and…
Tudoran Bogdan
  • 63
  • 1
  • 1
  • 3
5
votes
4 answers

How BIG do you make your Nvarchar()

When designing a database, what decisions do you consider when deciding how big your nvarchar should be. If i was to make an address table my gut reaction would be for address line 1 to be nvarchar(255) like an old access database. I have found…
Paul
  • 1,815
  • 5
  • 27
  • 44
5
votes
1 answer

creating index on nvarchar(max) column

I have table contains three columns. If I select NVARCHAR(MAX) column in my select statement, I see poor performance. Is it possible to create index on a NVARCHAR(MAX) column?. CREATE TABLE TEST ( id primary key, product VARCHAR(50), …
Ram
  • 727
  • 2
  • 16
  • 33
5
votes
2 answers

How to use PHP PDO ODBC with SQL Server and Unicode Characters?

PHP PDO ODBC doesn't seem to be able to store NVARCHAR characters (UTF-16) without some manual encoding. This seems like a pretty commun "bug" all around the internet and no one seems to have a definitive solution. How to reproduce the bug Try to…
Gudradain
  • 4,653
  • 2
  • 31
  • 40
5
votes
2 answers

Weird SQL Server 2005 Collation difference between varchar() and nvarchar()

Can someone please explain this: SELECT CASE WHEN CAST('iX' AS nvarchar(20)) > CAST('-X' AS nvarchar(20)) THEN 1 ELSE 0 END, CASE WHEN CAST('iX' AS varchar(20)) > CAST('-X' AS varchar(20)) THEN 1 ELSE 0 END Results: 0 1 SELECT …
richardtallent
  • 34,724
  • 14
  • 83
  • 123
5
votes
1 answer

MaxLength and how it affects queries

I am using Entity Framework 4.3.1, code first and am looking in SQL Profiler at the queries that are being produced. Here is one for example: As you can see - it is specifying the arguments as nvarchar(max) but in my configuration I have specified…
xsl
  • 17,116
  • 18
  • 71
  • 112