Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
662 views
Welcome To Ask or Share your Answers For Others

1 Answer

SQL Server doesn't support auto-increment. Nor does SQL Server -- or any other database -- support single quotes for column names (as far as I know).

I would recommend writing the statement as:

CREATE TABLE sqlalchemy_generic_types (
    sqlalchemy_generic_type_id INT IDENTITY(1, 1) PRIMARY KEY,
    ObjectName VARCHAR(25) NOT NULL,
    Description VARCHAR(100) NOT NULL
);

Note the changes:

  • IDENTITY() is assigns an increasing value to the id.
  • The id is given a meaningful name.
  • The space is removed from ObjectName, so the name does not need to be escaped.
  • No escape characters are needed to define the table.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...