views:

87

answers:

1

I'm maintaining an application that uses SQL Server Express 2005 as the back end. The application allows users to create new databases and provide the name for the new database.

When the app is loading the default data I make the following SQL call:

DBCC CHECKIDENT('[myDB].[CsSchema].[CsMyDataType]', RESEED) WITH NO_INFOMSGS

The code works fine as long as everything is in English.

But if the user specifies Chinese characters in the database name the call look like this:

DBCC CHECKIDENT('[e安丞北e].[CsSchema].[CsMyDataType]', RESEED) WITH NO_INFOMSGS

This call fails with this error message: "Could not find database 'e???'. The database either does not exist, or was dropped before a statement tried to use it."

I make many other calls with the database name that work properly. For example, this statement executes without an issue.

SET IDENTITY_INSERT [e安丞北e].[CsSchema].[CsMyDataType] OFF

The error seems to be specific to the DBCC CHECKIDENT call. Any ideas?

Note: I'm running on Chinese version of Windows XP.

+1  A: 

Try passing the string as unicode (see KB):

DBCC CHECKIDENT(N'[e安丞北e].[CsSchema].[CsMyDataType]', RESEED) WITH NO_INFOMSGS
Lucero
perfect. Thank you.
epotter