Unicode collation for SQL Server 2005? - sql-server-2005

I need a collation for a database that correctly stores any Unicode character in a SQL Server 2005 instance. The column currently is of type nvarchar (can be changed). How can I do that?

Collation has no connection to storage of N[VAR]CHAR data - it states the rules of comparison between strings.
So - you made the right choice - NVARCHAR

Related

SQL Collation issue between SQL 2000 and SQL 2008

I am querying a sql 2000 database on a sql 2008 database (linked server) and in the linked server i have a data with accents in. However when i query the 2008 database the accents appear correctly and as expected. But when i run the query on sql 2000 database the data is not showing correctly.
SQL 2000 Collation - SQL_Latin1_General_CP1_CI_AS
SQL 2008 Collation - SQL_Latin1_General_CP850_BIN2
I have attempted to add "COLLATE" to my queries however it is just not showing the data correctly.
Any ideas?
Thank you.
It turned out the issue was that the data types for the columns were varchar when they needed to be nvarchar. By dropping the table and recreating it with the correct data type this resolved my issue.

applying collation to sql server databases

I am currently working with applying collations to my sql server databases which are housed on a database server - sql server 2012.
Each of the databases will have different collations as the data varies from Latin, to Cryillic and one Arabic database.
I have 3 questions:
Is it possible to apply a number of collations to the same sql server database?
The fact databases of different collations are on the same database server, could their potential for conflict between the collation of the server and the databases?
Finally - is there a script I can use to apply a collation to each of the databases, noting they are created and contain data?
Is it possible to apply a number of collations to the same sql server
database?
The database collation is just the default for new columns in that database. You can specify different collations all you like as long as it's for different columns. You can even specify collation in views or ad-hoc SQL.
The fact databases of different collations are on the same database
server, could their potential for conflict between the collation of
the server and the databases?
The server collation is just the default collation for a new database. Typically, it's also the collation used by master and tempdb. That means queries against temporary tables require you to explicitly specify the collation.
Finally - is there a script I can use to apply a collation to each of
the databases, noting they are created and contain data?
You can use the alter database command:
ALTER DATABASE TestDb ALTER COLLATION French_CI_AI
Note that all existing columns will keep their collation. As said, the database collation is just the default for new columns.

Can unicode chars in sql queries cause slow db performance?

Can use of unicode chars in queries cause database to slow down?
I am using a query like
Select * from table where name='xyz¿½'
After this query my application slows down permanently until I restart it.
I am using c3p0 hibernate's connection pool
A modern database should support Unicode, but that may be restricted to certain data types.
For example SQL Server only supports Unicode for the following data types:
nchar
nvarchar
nvarchar(max) – new in SQL Server 2005
ntext
Unicode string constants (say within stored procedures/functions) should be preceded with the letter N e.g. N'abcd'
I found that sybase does not use an index when query contains unicode characters. It may be due to some charset settings in my version.

Oracle-->SQL - forced conversion from non-unicode to unicode?

I have an ETL that is importing tables from Oracle to SQL 2008 using the OLEDB FastLoad.
The data in Oracle is non-unicode.
When the table is created in SQL it is created with unicode datatypes.
For some reason the datatypes are being forced from non-unicode to unicode.
Do any of you know of a way to stop this from happening?
Possibly a Oracle driver problem?
I'm presuming you are using SSIS?
Guess what, SSIS wants everything to be unicode, so it assumes that all incoming data is in unicode. If you don't want it to be unicode, you will need to convert each field using a dataconversion task.
This is something you might want to try. Check the value of the NLS_LANG variable in the Oracle Database you are importing to. Changing this variable before running the ETL could help you.
Check the NLS_LANG faq here:
http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm

"Invalid character value for cast specification" for linked 2008 SQL server in 2005 instance

I am attempting to create a linked server from a 2005 to 2008 Microsoft SQL Server. I do this regularly for 2005 instances, but this is the first step of my long journey into SQL 2008. I am able to create the linked server as any other linked server, I receive no errors, however any time I try to use the linked server for anything (a simple "SELECT *" statement, for example) I get this error in SSMS:
"OLE DB provider "SQLNCLI" for linked server {linked server name} returned message "Invalid character value for cast specification"."
What do I need to know about creating a linked server to a 2008 instance in a 2005 instance?
Turns out the tables I kept choosing to test, the most business important tables on the 2008 server, each had fields of the "geography" data type, which is new to 2008. When testing queries on one of the other tables without this datatype the query works correctly.
So...you know... it was...an "Invalid character value for cast specification" after all.
I suspect that this may be a collation issue.
Check that the collation is the same at the server, database and table levels.
To check the detault server collation run the following T-SQL:
exec sp_helpsort
To check the Databasea collation do the following:
SELECT DATABASEPROPERTYEX('DatabaseName', 'Collation') SQLCollation;
It's either collation (my first guess), or Unicode conversions (VARCHAR vs NVARCHAR). I'd upvote John, but I don't have enough reputation.
Was there a particular way that you were able to query the table on the linked server that had the geography fields and not get the error?
I have the same issue where I need to query a linked server and some of the tables have geography fields in them and even if I only select a text field I get the error. The only workaround that I can think of would be to split the geography fields off to new tables so that the queries to the tables don't break.