1
我有表:計算從表中根據不同的柱從另一個tablecomputed柱的柱基於不同
create table Aprovizionari
(
ID_Aprovizionare int identity(1,1) primary key,
CodCarte char(3) foreign key references Carti(CodCarte),
CodLibrarie char(3) foreign key references Librarii(CodLibrarie),
DataAprovizionare date default getdate(),
Cantitate int default 1
)
create table Returnari
(
CodRet char(3) primary key,
CodCarte char(3) foreign key references Carti(CodCarte),
CodLibrarie char(3) foreign key references Librarii(CodLibrarie),
CodEditura char(4) foreign key references Edituri(CodEditura),
DataRet date,
Cantitate int
)
我有遞減柱Cantitate(數量)從Aprovizionari(供應),而餘的觸發從另一張桌子Facturi(Invoices)添加Cantitate。
在Returnari(返回-of書籍),我應該有:
DataRet date,--this should be =DataAprovizionare+3 mounths
Cantitate int--this should be=the remaining Cantitate(Quantity) from Aprovizionari at date=DataAprovizionare+3 mounts
是否在'Aprovizionari'記錄後3個月自動創建'Returnari'記錄? – OGHaza
沒錯! :) – user3279198