ALTER PROCEDURE Product_Diamond_Add
(
@catalogID INT,
@code NVARCHAR(20),
@productName NVARCHAR(20),
@weight INT,
@zu_MarketPrice INT,
@discount SMALLINT,
@unit NVARCHAR(10),
@cycle SMALLINT,
@orgID INT,
@brandID INT,
@description NVARCHAR(2000),
@isDisplay BIT,
@propertyTableID INT,
@shapeID INT,
@measurement NVARCHAR(50),
@cut SMALLINT,
@color SMALLINT,
@clarity SMALLINT,
@polish SMALLINT,
@symmetry SMALLINT,
@totalDepth INT,
@width INT,
@length INT,
@depthPercent INT,
@tablePercent INT,
@fluorescence SMALLINT,
@culet SMALLINT,
@girdle SMALLINT,
@additionalInscription NVARCHAR(50),
@laserRegistry NVARCHAR(50)
 )
AS-- Declare a variable to hold the generated product ID
DECLARE @id INT
-- Create the new product entry
INSERT INTO Product (code,productName,weight,zu_MarketPrice,discount,unit,cycle,orgID,brandID,description,isDisplay,propertyTableID) VALUES (@code,@productName,@weight,@zu_MarketPrice,@discount,@unit,@cycle,@orgID,@brandID,@description,@isDisplay,@propertyTableID)SELECT @id = @@IDENTITYINSERT INTO CatalogProduct (catalogID,productID) VALUES (@catalogID,@id)
INSERT INTO Diamond (productID,shapeID,measurement,cut,color,clarity,polish,symmetry,totalDepth,width,length,depthPercent,tablePercent,fluorescence,culet,girdle,additionalInscription,laserRegistry) VALUES (@id,@shapeID,@measurement,@cut,@color,@clarity,@polish,@symmetry,@totalDepth,@width,@length,@depthPercent,@tablePercent,@fluorescence,@culet,@girdle,@additionalInscription,@laserRegistry)