views:

133

answers:

3

How do I set the the default encoding of my local file SQL-Server database?

Thanks.

EDIT: Removed the UTF-8

A: 
/*!40101 SET NAMES utf8 */

Something like that

wishi
Where do I write that?
TTT
A: 

SQL Server dows not support UTF-8. Use nvarchar (UTF-16) if you dont mind using double space or varbinary if you dont need sort/indexing/comparision.

May be supported in next release of SQL Server according to this post

Fedearne
+2  A: 

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()
Andomar