我有 3 个表:Contract, ContractElement(ContractElementProduct合同可以有多个ContractElement,ContractElement也可以有多个ContractElementProduct)。
我想复制一份合同/签订新合同,但合同要素和ContractElement产品相同。
我可以为该合同制作新合同和新元素(等于第一个合同元素),但我不能复制ContractElementProducts?
insert into ContractElement
select newid(), @NewContractId, ElementId, ElementValue, Number
from ContractElement
where ContractId = @FirstContractId