CREATE TABLE [dbo].[REQUISITION]
(
[COMPANY] [int] NULL,
[WAVE] [varchar](50) NOT NULL,
[FROM_LOC] [varchar](3) NOT NULL,
[TO_LOC] [varchar](5) NOT NULL,
[PRODNUM] [varchar](25) NOT NULL,
[PRODDESC] [varchar](50) NULL,
[QTY] [int] NULL CONSTRAINT [DF_REQUISITION_WAVE1] DEFAULT ('SP'),
CONSTRAINT [PK_REQUISITION1]
PRIMARY KEY CLUSTERED ([FROM_LOC] ASC, [TO_LOC] ASC, [PRODNUM] ASC, [WAVE] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
答案 0 :(得分:0)
我认为你必须设置你的varchar字段的长度。
使用这个:
/****** Object: Table [dbo].[REQUISITION] Script Date: 14.01.2016
21:46:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[REQUISITION](
[COMPANY] [int] NULL,
[WAVE] [varchar](1) NOT NULL,
[FROM_LOC] [varchar](1) NOT NULL,
[TO_LOC] [varchar](1) NOT NULL,
[PRODNUM] [varchar](1) NOT NULL,
[PRODDESC] [varchar](1) NULL,
[QTY] [int] NULL,
CONSTRAINT [PK_REQUISITION1] PRIMARY KEY CLUSTERED
(
[FROM_LOC] ASC,
[TO_LOC] ASC,
[PRODNUM] ASC,
[WAVE] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[REQUISITION] ADD CONSTRAINT [DF_REQUISITION_WAVE1] DEFAULT ('SP') FOR [QTY]
GO