开发者

Why is my table name not valid?

开发者 https://www.devze.com 2023-01-19 01:06 出处:网络
Here is the create statement: create table dbmonitor.DBMON_DATABASE_TYPE ( DATABASE_TYPE_ID BIGINT IDENTITY NOT NULL,

Here is the create statement:

create table dbmonitor.DBMON_DATABASE_TYPE (
        DATABASE_TYPE_ID BIGINT IDENTITY NOT NULL,
       DispName NVARCHAR(255) null,
       primary key (DATABASE_TYPE_ID)
    )

and this is the error I get:

13:40:57,685 ERROR [TestRunnerThread] SchemaExport [(nu开发者_开发知识库ll)]- The table name is not valid. [ Token line number (if known) = 1,Token line offset (if known) = 24,Table name = DBMON_DATABASE_TYPE ]
The table name is not valid. [ Token line number (if known) = 1,Token line offset (if known) = 24,Table name = DBMON_DATABASE_TYPE ]


Possibilities:

  1. Is dbmonitor the name of your database? You can't put a . in a table name.
  2. Do you mean CREATE TABLE dbmonitor.dbo.DBMON_DATABASE_TYPE?
  3. Did you try CREATE TABLE DBMON_DATABASE_TYPE?


I'm not sure if dbmonitor is meant to be a schema name, but according to the documentation for the SQL CE CREATE TABLE statement, you cannot include a schema name with the table name.

Contrast this for SQL Server 2005 Compact Edition (just showing the initial part of the statement),

CREATE TABLE table_name 
   ( { < column_definition > | < table_constraint > } [ ,...n ] 
   ) 

with this for SQL Server 2008:

CREATE TABLE 
    [ database_name . [ schema_name ] . | schema_name . ] table_name 


This may not be exactly an answer for this question's criteria , but for those who might get here :

this error can also happen when you try to use EntityFramework.Extended library with Sql Server CE. It seems that they are not compatible.

check these links :

https://github.com/loresoft/EntityFramework.Extended/issues/35

https://github.com/loresoft/EntityFramework.Extended/issues/11

0

精彩评论

暂无评论...
验证码 换一张
取 消