April 30, 2005 at 6:34 am
Sorry for posting more than once.. please help me...
i would like to know if it is possible to get data from one table and take it to another table..
for example
CREATE TABLE Company (dpt_no int unsigned not null auto_increment primary key, dpt_name char(20) not null, salary money not null)
****
CREATE TABLE sales_dpt (s.no int unsigned not null auto_increment primary key, first_name char(20) not null, last_name char(20) not null, dpt_name char(20) not null, , salary money not null)
****
i only want the salary column from Company table to go to salary column in the sales_dpt table automatically!!!
what would they trigger or stored procedure be?
thanx in advance
April 30, 2005 at 10:14 am
What about the department name column?
What do you want to happen when a salary in Company is updated?
What is the link between Company and sales_dpt?
It could be as simple as
CREATE TRIGGER dbo.tr_company ON dbo.company for insert as
INSERT sales_dpt(dpt_name,salary)
SELECT dpt_name,salary
FROM inserted
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply