vanpersie 0 Light Poster

Hi guys
I have a database involving the following table
Inventory TableItem_code int primary key,
Item_name varchar(50),
Item_cost money,
Imported_quantity numeric(18,0),
Item_Quantity numeric (18,0)'


Sale Table:-
item_code int foreign key references Inventory(item_code) ,
withdrawal_id foreign key References Withdrawal_Operations(withdrawal_id)
,quantity_Available_for_Sale numeric(18,0),
quantity_withdrawan numeric(18,0),
selling_price money,
quantity_sold numeric(18,0),
Sale_Operation_Date datetime
,
Item_cost money.

Withdrawal_Operations Table
Withdrawal_id int primary key,item_code foreign key references Inventory(item_code),
quantity_withdrawan numeric(18,0)


I need A trigger for the following operation
A user Want to transfer some quantity from the store(inventory table) to the Sale Table on the quantity_Available_for_Sale column , of course the quantity in the store(invetory table ) on the item_quantity column

column will decrease.

And the quantity on the sale table will be increase

the value quantity transfered is inserted on the quantity_withdrawan column.

I may need to add the quantity_withdrawan column to the Inventory Table to do this transaction.
My Database Diagram

http://img199.imageshack.us/img199/3900/salediagram.jpg
I will be glad if someone help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.