Unicode Support- MS SQL

From Hostek.com Wiki
Jump to: navigation, search

Enabling Unicode Characters For a Table

  • If you're having issues getting unicode characters to insert into your MS SQL database there are a couple of things you can do to get it working:

Default Collation

  • First you can set the collation for your MS SQL database to the language set you're needing to insert characters for.
  1. Click on "MS SQL" in the WCP
  2. Click the edit button next to your MS SQL database
  3. Select the default collation you want to use from the drop-down menu and click "Save"
  4. For example if you're needing to insert Russian characters you would use "Cyrillic_General_BIN"
  • You can also use an SQL statement to change the collation for a particular column:
ALTER TABLE table-name
ALTER COLUMN testcolumn varchar(10) COLLATE Cyrillic_General_BIN
  • You'll need to replace the "table-name" and "testcolumn" values with the actual table name and column name you want to change

Change Datatype

  • Some datatypes such as "varchar" are not able to contain unicode characters so you'll want to change the datatype to "nvarchar"
  • You can change the datatype for a database column using "MyLittleAdmin" in the WCP or by using "SQL Management Studio"