nvarchar

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 CASE WHEN CAST('i' AS nvarchar(20)) > CAST('-' AS nvarchar(20)) THEN 1 ELSE 0 E...

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 any characters represented by unicode needed to be entered. However, I didn't think about a...

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] ,[QuestionText]) VALUES (@lastinsertedquestionid ...

A ideal data type for long utf8 strings in mysql

Hi! Is it true that VARCHAR type in mysql only suppory 255 characters data length? if it is true what kind of datatype for UTF8 strings is useful for long texts? I'm using utf8_persian_ci datatype. Note that TEXT datatype have problem with utf8_persian_ci. ...

nvarchar concatenation problem.

Hi All, I am probably trying to do a simple thing after dealing with all the hard stuff but seems like this is giving me a headache. I am trying to concatenate text into variable @strXml which is an nvarchar variable to build Xml element, but @strXml returns null. Please help. I am posting my code below. DECLARE @strXml nvarchar(max) = ...

FluentNHibernate and VARCHAR Columns

Hi everyone, I am starting a simple .NET project with FluentNhibernate. I've followed few examples I've found on the Internet and it seems quite easy to grasp. I've realized that if I let FluentNhibernate build my DB schema (Sql Server 2000) it generates NVARCHAR fields for my strings model properties. Someone suggested that I can add ...

T-SQL: How to obtain the the exact length of a string in characters?

I'm generating T-SQL SELECT statements for tables for which I have no data type information up-front. In these statements, I need to perform string manipulation operations that depend on the length of the original value of the tables' columns. One example (but not the only one) is to insert some text at a specific position in a string, ...

C# Error: Error converting nvarchar datatype to int. HELP!

Hello everyone, i'm having a really hard time with my c# application. Everytime i run the code below, it gives me an error about the convertion of nvarchar datatype to int. I have tried casting but it doesn't seem to work. ConnectionString myConnString = new ConnectionString(); string connString = myConnString.getConnectionString(); Sq...

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 use for character (non-binary) strings: In SQL Server, NCHAR is stored as UTF-16LE and is the only way to reliably store non-ASCII charac...

Is there a way to get SQL Server to automatically do selects on hash values of nvarchar fields?

I'm not sure how to better phrase this question so it's possible I missed a previously asked question. Feel free to close this and point me to the correct one if it exists. I have a table with two important columns (that is to say it has much more but only two is pertinent to this question). First column is a GUID (an id) and the second...

Selecting not null column

I have a table with varbinary(max) column and nvarchar(max) column. One of them is null and the other has a value. I would like to return the column that has the value as a varbinary(max) column. So far I have tried this, that does not work: SELECT A = CASE A WHEN NULL THEN B ELSE A END FROM Tabl...