Linked Questions

4 votes
1 answer
1k views

why varchar is slower than nvarchar [duplicate]

Possible Duplicate: varchar vs nvarchar performance I have changed all nvarchar column to varchar for a hope to speed up query. but my Query now become slow. before it was running 15 sec, now run ...
Shuvra's user avatar
  • 213
1705 votes
22 answers
1.5m views

What is the difference between varchar and nvarchar?

Is it just that nvarchar supports multibyte characters? If that is the case, is there really any point, other than storage concerns, to using varchars?
stimms's user avatar
  • 43.5k
84 votes
7 answers
137k views

When must we use NVARCHAR/NCHAR instead of VARCHAR/CHAR in SQL Server?

Is there a rule when we must use the Unicode types? I have seen that most of the European languages (German, Italian, English, ...) are fine in the same database in VARCHAR columns. I am looking ...
Peter Gfader's user avatar
  • 7,681
46 votes
14 answers
11k views

Is VARCHAR like totally 1990s? [closed]

VARCHAR does not store Unicode characters. NVARCHAR does store Unicode characters. Today's applications should always be Unicode compatible. NVARCHAR takes twice the amount of space to store it. Point ...
Edward Tanguay's user avatar
57 votes
3 answers
25k views

What's the SQL national character (NCHAR) datatype really for?

As well as CHAR (CHARACTER) and VARCHAR (CHARACTER VARYING), SQL offers an NCHAR (NATIONAL CHARACTER) and NVARCHAR (NATIONAL CHARACTER VARYING) type. In some databases, this is the better datatype to ...
bobince's user avatar
  • 532k
13 votes
9 answers
12k views

varchar or nvarchar

I am storing first name and last name with up to 30 characters each. Which is better varchar or nvarchar. I have read that nvarchar takes up twice as much space compared to varchar and that nvarchar ...
Waheed's user avatar
  • 10.2k
27 votes
5 answers
13k views

SQL Server uses high CPU when searching inside nvarchar strings

Check out the following example. It shows that searching within a unicode string (nvarchar) is almost eight times as bad as searching within a varchar string. And on par with implicit conversions. ...
Michael J Swart's user avatar
6 votes
6 answers
5k views

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 ...
mmcdole's user avatar
  • 92.2k
3 votes
5 answers
16k views

SQL Server Pivots: Displaying row values to column headers

I have a table (items) which is in the following format: ITEMNO | WEEKNO | VALUE A1234 | 1 | 805 A2345 | 2 | 14.50 A3547 | 2 | 1396.70 A2208 | 1 | 17.65 A4326 | ...
thegunner's user avatar
  • 7,003
6 votes
2 answers
11k views

UCS-2 and SQL Server

While researching options for storing mostly-English-but-sometimes-not data in a SQL Server database that can potentially be quite large, I'm leaning toward storing most string data as UTF-8 encoded. ...
Eric J.'s user avatar
  • 149k
5 votes
4 answers
6k views

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(...
Paul's user avatar
  • 1,815
10 votes
1 answer
3k views

How significant is the performance difference when joining on nvarchar versus on int

I understand that join on nvarchar is slower because index is bigger as nvarchar using 2 bytes for each character but int is 4 bytes all the time. Is the join performance difference significant? Is ...
Andras Csehi's user avatar
  • 4,305
2 votes
3 answers
3k views

Sql Server - does VARCHAR length indicate max number of characters or number of bytes?

For a SQL Server column of type VARCHAR(100) Before I insert into the column, I want to make sure that the value being inserted is not greater than 100. Is that number specifying the max number of ...
Josh Withee's user avatar
  • 10.6k
3 votes
1 answer
16k views

UTF-8 Support, SQL Server 2012 and the UTF8String UDT

Researching the pro's and con's of SQL Server's VARCHAR vs. NVARCHAR for my particular application, I came to the realization that it would be ideal if SQL Server supported UTF8 natively. Several SO ...
Eric J.'s user avatar
  • 149k
2 votes
5 answers
2k views

T-SQL finding of exactly same values in referenced table

Lets assume I have 3 tables in my Sql Serer 2008 database: CREATE TABLE [dbo].[Properties]( [PropertyId] [int] NOT NULL, [PropertyName] [nvarchar](50) NOT NULL ) CREATE TABLE [dbo].[Entities](...
Egor4eg's user avatar
  • 2,688
3 votes
8 answers
511 views

What are common pitfalls when developing a new SQL database?

I know, I quite dislike the catch-all survey type questions, but I couldn't think of a better way to find out what I think I need to know. I'm very green in the world of database development, having ...
0 votes
4 answers
2k views

SQL nvarchar Performance

I'm storing localized strings in a single datatable using MS Sql (2008 or whatever). Most of the strings are short and can be represented with varchar(200), while about 10% are much longer require ...
Paul's user avatar
  • 6,208
0 votes
4 answers
2k views

Performance tuning on reading huge table

I have a huge table with more than one hundred million of rows and I have to query this table to return a set of data in a minimum of time. So I have created a test environment with this table ...
Dan's user avatar
  • 625
1 vote
1 answer
4k views

Handling NVARCHAR columns with MS SQL Server and Hibernate

I have an application which uses MS SQL Server 2005 as the DBMS and jTDS as the JDBC driver. All the columns storing text are of type VARCHAR. A sendStringParametersAsUnicode=false parameter has been ...
Carlos's user avatar
  • 2,503
3 votes
2 answers
1k views

Why n in varchar(n) is to be specified as concrete digit?

I did red-read on this and could not clearly understand... Having (for the purpose of shortening this question) DECLARE @temp VARCHAR(4001); --update: 4001 is for example only to avoid varchar(...
Gennady Vanin Геннадий Ванин's user avatar
1 vote
1 answer
2k views

SQL server globalization

When using arabic language, data is stored in database with ? (question mark) sign instead of real arabic characters in SQL server. Suggest me solution if anybody have idea.
Nijesh patel's user avatar
4 votes
5 answers
243 views

Sql Server Indexing on a table with no joins and predictable query

Ok before I start I want to say, I am totally new to this Sql indexing thing. I have a table that is not join to anything. It has the following columns: Id (int) String1 (nvarchar(10) String2 (...
Chi Chan's user avatar
  • 12.2k
0 votes
6 answers
339 views

what could be the datatype for the column having weblinks

One curious question. if i have a table with column with weblinks then what could be the datatype nvarchar or varchar. and what could be the size of that datatype?
User7354632781's user avatar
2 votes
1 answer
637 views

T-SQL Unicode "word" definition

I'm new to Unicode in Microsoft SQL Server 2005 / 2008. I converted my DB to use NVarChar() instead of VarChar(). I found to my surprise that the sorting is different than with VarChar(). I found ...
user avatar
-1 votes
2 answers
447 views

What is the difference between nvarchar of different number?

I only started learning SQL less than a week ago and I have noticed in SQL Server, string can be of type nvarchar(5) or nvarchar(20) or any other number. I was just wondering what is the difference ...
Thor's user avatar
  • 9,888
1 vote
1 answer
205 views

Strange SQL Server type conversion issue

I've experienced today strange issue. One of my projects is running .NET + SQL Server 2005 Express. There is one query I use for some filtering. SELECT * FROM [myTable] where UI = ...
Random's user avatar
  • 4,639
0 votes
1 answer
287 views

SQL nvarchar considerations

What's your strategy for determining nvarchar column sizes say for a address field? Do you always use nvarchar(max) or a fixed maximum size? There is nothing worse than data integration breaking due ...
Johannes Rudolph's user avatar
0 votes
1 answer
156 views

How can I see non-standard characters in MS Access (Stored in SQL Server) correctly

I currently store my string fields in SQL Server as varchar(x). The Database stores records from across the globe, but non standard characters, such as 'glyphics from Asia or Cyrillic Script/Azbuka ...
aSystemOverload's user avatar
0 votes
1 answer
103 views

Best SQL Type for Variable Value

I have a table that holds PDF's with meta data, it also has 10 anonymous rows in it. These rows can be used to hold any C# Data Type as each user may use it for a different reason. There are a ...
Michael's user avatar
  • 8,521