我的代碼(PROYECT_A A00001)有沒有辦法做到這一點,不重複?
有3個表(段SE00001,LABLE LA00001,強ST00001),涉及到一個項目,有可能從這些表中重複代碼,但它們屬於處理項目只有一個項目
有沒有辦法不重複字段?
CREATE TABLE [dbo].[PROYECT_A](
[PROYECT_A] [int] IDENTITY(1,1) NOT NULL,
[CODE_A] AS ('A'+right('00000'+CONVERT([varchar],[PROYECT_A],(0)),(5))),
[STATUS] [datetime] NOT NULL,
[CREATION_DATE] [datetime] NOT NULL,
CONSTRAINT [PK_RR] PRIMARY KEY CLUSTERED
(
[CODE_A] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
CREATE TABLE [dbo].[SEGMENT](
[ID_SEGMENT] [int] IDENTITY(1,1) NOT NULL,
[CODE_SE] AS ('SE'+right('00000'+CONVERT([varchar],[ID_SEGMENT],(0)),(5))),
[NAME] [varchar](20),
[POWW] [varchar](20),
[SQWE] [varchar](20),
[DATESTART] [datetime] NOT NULL,
[DATESTART] [datetime] NOT NULL
[CODE_A] [varchar](20)
GO
CREATE TABLE [dbo].[LABLE](
[ID_LABLE] [int] IDENTITY(1,1) NOT NULL,
[CODE_LA] AS ('LA'+right('00000'+CONVERT([varchar],[ID_LABLE],(0)),(5))),
[NAME] [varchar](20),
[POWW] [varchar](20),
[SQWE] [varchar](20),
[DATESTART] [datetime] NOT NULL,
[DATESTART] [datetime] NOT NULL
[CODE_A] [varchar](20)
GO
CREATE TABLE [dbo].[STRONG](
[ID_STRONG] [int] IDENTITY(1,1) NOT NULL,
[CODE_ST] AS ('ST'+right('00000'+CONVERT([varchar],[ID_STRONG],(0)),(5))),
[NAME] [varchar](20),
[POWW] [varchar](20),
[SQWE] [varchar](20),
[DATESTART] [datetime] NOT NULL,
[DATESTART] [datetime] NOT NULL
[CODE_A] [varchar](20)
GO
哪些字段包含「重複的代碼」?請張貼一些樣本,並指出哪些數據是問題 –
您好Martin - 歡迎來到Stack Overflow!在這一點上,我不確定你在問什麼。如果問題出在數據上,請發佈您目前看到的內容,以及它應該是什麼。 – nwhaught