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

转换数据库语法问题
CREATE TABLE analysismodel (
  modelId BIGINT NOT NULL IDENTITY,
  com_id BIGINT DEFAULT NULL,
  modelName VARCHAR(200) DEFAULT NULL,
  modelNotes VARCHAR(500) DEFAULT NULL,

  PRIMARY KEY (modelId),
  INDEX FK_analysismodel_company_com_id (com_id),
  CONSTRAINT FK_analysismodel_company_com_id FOREIGN KEY (com_id)
  REFERENCES company(com_id) ON DELETE RESTRICT ON UPDATE RESTRICT
)
上面是My sql创建的语法、我怎么把它改成sql server创建的语法?主要是外键部分

------解决方案--------------------
SQL code
CREATE TABLE analysismodel (
  modelId BIGINT IDENTITY(1,1) primary key ,
  com_id BIGINT REFERENCES company(com_id) ON DELETE CASCADE on update CASCADE ,
  modelName VARCHAR(200) DEFAULT('') ,
  modelNotes VARCHAR(500) DEFAULT('')
)