如何解决此代码的错误

时间:2014-06-24 07:44:46

标签: sql sql-server-2008

CREATE TABLE ITEM
(
ITEMCODE CHAR(2) PRIMARY KEY,
ITEMNAME VARCHAR(20) NOT NULL,
UNIT_MEASURE VARCHAR(10) CHECK (UNIT_MEASURE IN ('MTR','KG','TONN','LTR','NOS')),
RATE NUMBER(10,2) CHECK (RATE > 0),
STOCK NUMBER(10,2),
MINSTOCK NUMBER(10,2),
MAXSTOCK NUMBER(10,2),
DRAWINGSP VARCHAR(10) DEFAULT 'DR1000',
CHECK (STORE BETWEEN MINSTOCK AND MAXSTOCK) );

1 个答案:

答案 0 :(得分:1)

CREATE TABLE ITEM
(
   ITEMCODE CHAR(2) PRIMARY KEY,
   ITEMNAME VARCHAR(20) NOT NULL,
   UNIT_MEASURE VARCHAR(10) CHECK (UNIT_MEASURE IN ('MTR','KG','TONN','LTR','NOS')),
   RATE NUMERIC(10,2) CHECK (RATE > 0),
   STOCK NUMERIC(10,2),
   MINSTOCK NUMERIC(10,2),
   MAXSTOCK NUMERIC(10,2),
   DRAWINGSP VARCHAR(10) DEFAULT 'DR1000',
   CHECK (STOCK BETWEEN MINSTOCK AND MAXSTOCK) 
);
  • SQL Server中没有类型NUMBER - >更改为numeric
  • 没有列STORE - >更改为STOCK