SQL Server displays ??? instead of Unicode characters - sql-server-2008

I run SQL Server 2008 Express on my Windows 8.1. After inserting some Unicode characters in Database, characters are not displayed properly (the data has no problem just displayed improperly). Manually inserting the values using 'Management Studio' will lead to the same result.
I typed information in Persian Language and installed persial Language pack for Windows 8.1 however this does not fixed anything.
Am I missed something in SQL Server options? The same configuration on windows 7 have no problems.

Check if your field is UNICODE (nchar or nvarchar).
Check collation for your database.
Make sure your UNICODE literals have N prefix.
UPDATE: check this, possible duplicate question

Changing type of fields from VARCHAR to NVARCHAR fixes the problem but it does not recover data stored in bad format.

Related

MySQL truncates latin-1 data when inserting to UTF-8 column. How to get an error?

Ok, had a problem when I was trying to insert an string that was believed came in UTF-8 format when truly was latin-1. Problem was, behaviour between different servers varied like:
Windows will give an error when confronted when a non-UTF8 char: "Incorrect string value: '\xD1OL S....' for column [...]"
Linux will quietly insert whatever I give it until it finds the first char it doesn't like, and then truncate the rest of the string.
For once, I find that the windows behaviour is the one I'd rather have. I've been looking and haven't found some kind of option to make the mysql linux server more strict.
Do you now of one?.
Thanks!.
Well, that was quick. Problem was, we had a 5.6 Linux server that was not in strict mode, though our DBA assured me that it was, making us think that it was a Linux problem.
So, just activate STRICT_ALL_TABLES. MySQL modes and how to activate them are here:
http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html

Exporting GUIDs to a text file in non-unicode

I'm exporting data from a MS Dynamics CRM 2011 database table to a text file. Initially I was just exporting string data - i.e. columns defined as nvarchar, and it worked fine. However when I added the primary key column - uniqueidentifier/guid, SSIS just outputs unicode to the text file.
I'm explicitly casting all columns in my SQL query to VARCHAR, and have ensured all the source/destination columns are defined as non-unicode strings i.e. DT_STR, but still get unicode in the file.
Funnily enough this only happens when I run the SSIS package on our server which has SSIS 2008/Windows 2008 Server 64-bit. Our database is SQL 2008 64-bit as well, also on a seperate Windows 2008 server. The package works fine on my PC - Win7 64-bit.
Any ideas why this is happening?
You might try using the bcp utility for your export.
http://technet.microsoft.com/en-us/library/ms162802.aspx
“The bcp utility bulk copies data between an instance of Microsoft SQL Server and a data file in a user-specified format”
The –N argument is documented as “Performs the bulk-copy operation using the native (database) data types of the data for noncharacter data, and Unicode characters for character data.” Which implies that by omitting this arg you will not get Unicode in the output.

How to display special characters in SQL server 2008?

I am using SQL server 2008 and have the column in my table set to nvarchar. Data with special characters are getting stored wrongly in this table. Eg: this is one entry
Need to check if doesn’t comes as doesn’t itself and don’t comes asdon’t itself and ensure closure of issues.
The garbage ’ should actually be an apostrophe ('). I have checked my collation string. At database level it is SQL_Latin1_General_CP850_BIN2 and at server level it is SQL_Latin1_General_CP1_CI_AS.
I know for sure the encoding set everywhere else in my application is UTF-8.
How do I store the data correctly in my table? Do I need to change my SQL queries or any settings in the database?
Please advise.
You need to make sure that you're observing two things:
Always use NVARCHAR as datatype for your columns
Always make sure to use the N'....' prefix when dealing with string literals (for example in your INSERT or UPDATE statements)
With those two things in place, SQL Server has no trouble at all storing all Unicode characters you might throw at it...

Convert database font from MS SQL to mysql utf8?

I have old database at one windows dedicated server and now i buy a new linux dedicated server with php and mysql.
I plan to using php to pull out database from ms sql server row by row and put it to mysql database.
But problem is mysql using utf8_unicode_ic and i don't know which charset MS SQL server used.
THanks for help.
Have you tried just running your code? Odds are it'll "Just work".
Caveats below:
You may run into issues in your data (although this is highly unlikely) because the character set you're referring to is actually a collation. That is, it defines the string "ABCDEFGH" to be equal to "abcdefgh". The "_ci" part of utf8_unicode_ci means it's case insensitive.
Some quick googling found that MySQL defaults to case and accent sensitive collation, that's good, because SQL Server does the same. You should check the collation of the SQL Server database, if it's "SQL_Latin1_General_CP1_CI_AS" you should be good.
SQL Server stores character-based data in extended (i.e. depending on Windows, operating system, code-pages/encodings installed and used on server machine) ASCII for non-unicode (char, varchar, text, etc.) types and in unicode (nchar, nvarchar, ntext, etc.) types. I believe internet has plenty of material on this FAQ topic

OpenJPA & MySQL persist wrong encoded characters

my mysql db has character encoding utf8. In QueryBrowser i can see special characters are correct. In appplication using openjpa i can see the same values also correct.
But when I persist object into DB, I have correct values in application but incorrect in DB!
When I restart application that special characters in application are incorrect.(as they are picked from DB)
All is set to UTF-8, java application works well, reading data from DB is correct but problem is when openjpa stores values in DB, they turn into '?'.
Any ideas? Thanks
Check your encoding on the MySql server configuration level (my.cnf file), and also on the level of a specific database. Once, I had similar issue when these two options has been set to different values (encodings).