Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Validity Check

Author  Topic 

mojam
Starting Member

5 Posts

Posted - 2009-09-26 : 00:22:17
I have Created three tables
1. Product
i. productid int primary key,
ii.productname varchar(50),
iii.model varchar(20),
iv.desc varchar(100)
2. Purchase
i. purchaseid int primary key,
ii. productid int foreign key,
iii.qty int,
iv.rate double,
v.total double
3. Sale
i. saleid int primary key,
ii. productid int foreign key,
iii.qty int,
iv.rate double,
v. total double

-- when I shall entry data into sale table, I have to ensure that sale qty would not greater than sum of the qty of purchase of any specific product
-- I have to calculate the balance sheet

Pls help

Kabila
Starting Member

33 Posts

Posted - 2009-09-26 : 03:18:35
Use Trigger to Validate the Condition in the Sales table
Go to Top of Page

mojam
Starting Member

5 Posts

Posted - 2009-09-27 : 01:50:06
quote:
Originally posted by Kabila

Use Trigger to Validate the Condition in the Sales table



Thanks for your advice. I m new in sqlserver. I have tried much to create a trigger. at last i failed. can anyone kindly help me pls??????
Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2009-10-05 : 16:40:31
can you paste what you tried
Go to Top of Page
   

- Advertisement -