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
5
votes
2 answers

How do I force nvarchar input width in SQL Server?

I’ve got a script that I’ve created for our production line where the user enters some variables into the script before executing. The Problem is that the variables are NVARCHAR(9) and if the user inputs a 10 character sting the last character is…
4
votes
1 answer

why varchar is slower than nvarchar

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 time is 26 sec. what could make this slower? am I…
Shuvra
  • 213
  • 2
  • 15
4
votes
1 answer

Add varchar column type with SQL Server using Laravel

I'm using Laravel 5.7 along with SQL Server 2017 and I want to generate a varchar(50) column called name. Executing this code gives me a nvarchar(50) instead: Schema::create('test', function(Blueprint $table) { $table->string('name',…
4
votes
3 answers

EF core to support nvarchar

I have an existing EF code first project which has created the database with all nvarchar columns in the database. Now I am starting another project on the same database for statistical purpose. This new project however is using EF core as pointing…
Jay
  • 299
  • 1
  • 5
  • 20
4
votes
2 answers

Microsoft SQL Server error with Laravel: Why this solves my mistake?

I am creating an application in Laravel, which accesses information stored in a remote database Microsoft SQL Server. And I have encountered an error, which I solved; but I do not quite know why... The Problem I created a "users" table within the…
tomloprod
  • 7,472
  • 6
  • 48
  • 66
4
votes
3 answers

Why not always use nvarchar over varchar when storing data?

Im building a website that might have unicode characters in it the client hasn't specified, I want to use nvarchar as the datatype on sql server. Is there any downside to using nvarchar over varchar. Why would anyone want to use varchar over…
Leslie Jones
  • 540
  • 2
  • 9
  • 22
4
votes
1 answer

Does Access have any issues with unicode capable data types like nvarchar in SQL Server?

I am using Access 2003 as a front end UI for a SQL Server 2008 database. In looking at my SQL Server database design I am wondering if nvarchar was the right choice to use over varchar. I chose nvarchar because I thought it would be useful in case…
webworm
  • 10,587
  • 33
  • 120
  • 217
4
votes
2 answers

SQL Server 2008 Nvarchar(Max) concatenation - Truncation issue

Can someone please explain why this is happening on SQL Server 2008: declare @sql Nvarchar(max); set @sql =N''; select @sql = @sql +replicate('a',4000) + replicate('b', 6000); select len(@sql) Returns: 8000 Multiple sites suggest that as long as…
Tomato Guy
  • 43
  • 1
  • 5
4
votes
1 answer

Oracle defaultNChar=true SLOW on NCHAR/NVARCHAR2

I am using a JDBC Prepared Statement with a bunch of parameters using setString(pos, value). The underlying columns on the tables are all NCHAR and NVARCHAR2. I have set the Oracle JDBC driver's "defaultNChar=true" so that Oracle DB would always…
4
votes
2 answers

No Dialect mapping for JDBC type: -9 w/Hibernate 3 & Oracle 10g

We recently started seeing this error for an application which was previously working. No code changes have been made to cause the error, nor database changes (to my knowledge). There was supposedly some fairly recent change made to the server's…
User
  • 293
  • 3
  • 19
4
votes
1 answer

Conversion between NVARCHAR to VARCHAR

I've got an Oracle DB with ALL the character columns defined as NVARCHAR or NCHAR or NCLOB, using charset UTF-16. Now I want to migrate to a new DB that has charset UTF-8. Since it can store unicode characters, I'm wandering if I will be able to…
Wishper
  • 343
  • 1
  • 3
  • 11
4
votes
5 answers

NVARCHAR sizes in SQL Server 2005

In SQL Server 2005 (not 7.0), is there any reason to use NVARCHAR(255) instead of 256 or some other number? Is there any optimal size, and is there any reason to use powers of two? (I will be storing Unicode data, so I have to use NVARCHAR)
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
3
votes
2 answers

JPA 2.0 - NVARCHAR in native query

The project that I'm working on has the following setup: JPA 2.0 (Hibernate 4 implementation) and SQL Server 2008 R2. I need to select some data from an SQL view. In order to do this I use a native query, but I ran into some problems with the…
Daniel Platon
  • 583
  • 7
  • 16
3
votes
3 answers

SQL Server 2008: Error converting data type nvarchar to float

Presently troubleshooting a problem where running this SQL query: UPDATE tblBenchmarkData SET OriginalValue = DataValue, OriginalUnitID = DataUnitID, DataValue = CAST(DataValue AS float) * 1.335 WHERE FieldDataSetID =…
user8128167
  • 6,929
  • 6
  • 66
  • 79
3
votes
1 answer

CAST nvarchar to datetime regardless of login date format?

I've got 2 servers with two different login date formats (English & British English). I need to be able to CAST an nvarchar value to datetime regardless of the date format. I have the following query: select cast('2011-13-07' as datetime) This…
Curtis
  • 101,612
  • 66
  • 270
  • 352