日期:2014-05-18  浏览次数:20327 次

设备激活错误。
在查询分析器中用代码创建数据库时   出现如下错误:

服务器:   消息   5105,级别   16,状态   2,行   3
设备激活错误。物理文件名   'D:\project\stuDB_data.mdf '   可能有误。
服务器:   消息   1802,级别   16,状态   1,行   3
CREATE   DATABASE   失败。未能创建所列出的某些文件名。请检查前面的错误信息。

请教高手如何解决,是哪里出了问题,代码不会错:
if   exists(select   *   from   sysdatabases   where   name= 'studb ')
drop   database   studb
go
create   database   studb
on   primary
(
name=studb_data,
filename   = 'D:\project\studb_data.mdf ',
size=5mb,
filegrowth=15
)
log   on
(
name=studb_log,
filename= 'D:\project\studb_log.ldf ',
size=5mb,
filegrowth=15
)
go

在线等     谢谢

------解决方案--------------------
我记得不用加引号的,这里没有环境,你把primary去掉试试看
------解决方案--------------------
有沒有D:\project這個文件夾?
------解决方案--------------------
http://support.microsoft.com/?id=836873

CAUSE
This problem occurs because the DefaultData and DefaultLog registry values that correspond to the default data directory and to the default log directory exist, but the folder paths that are mentioned in the registry values are either blank or do not exist.


To work around this problem, use one of the following methods:
Set the default data directory value and the default log directory value to valid folder paths
You can set the default data directory value and the default log directory value by using either SQL Server Enterprise Manager or Registry Editor.

------解决方案--------------------
up
------解决方案--------------------
你沒有D:\project這個文件夾吧?要不是不会错的