Reputation: 4874
How to set encoding of database in Microsoft Server Managment Studio?
I need to set utf8 to my database and I can't find option in settings of database.
Upvotes: 0
Views: 7805
Reputation: 2266
You cannot set UTF8 encoding to SQL Server database.
You can use char/varchar data types to save characters- one character = one byte- but that also means you can save only limited characters (see collations).
You can use nchar/nvarchar data types to save characters- one character = two bytes (its UCS-2. for sorting, searching.. see collations).
Finally in varbinary column you can store UTF8 or whatever you need :).
Upvotes: 1
Reputation: 22076
It is taken from here How do I set database default Encoding?
Assuming by encoding you mean collation, you can change the default for new databases like:
alter database model collate SQL_Latin1_General_CP1_CI_AS
The change the collation of an existing database:
alter database YourDbName collate SQL_Latin1_General_CP1_CI_AS
The list of available collations is returned by a system function:
select * from fn_helpcollations()
Upvotes: 1