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
 New to SQL Server Programming
 Write a stored procedure & trigger

Author  Topic 

summy
Starting Member

2 Posts

Posted - 2011-04-13 : 03:11:57
I'm trying to add a column to an existing table using procedure to set the value of this new column according to the another column in different table..I think the trigger part is not hard but I'm struggling with the stored procedure..any help please??
Thanks in advance!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-13 : 03:50:55
To add a column to a table is IMHO a one time thing.
Why do you want to write a stored procedure for that?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

summy
Starting Member

2 Posts

Posted - 2011-04-13 : 11:25:13
You are right; to add a column to a table is one time deal but in this problem I want to write a stored procedure to set the value of CUS_TOTAL_DISTANCE in the CUSTOMER table(to represent the total number of miles flown) according to the distances in the CHARTER table.

2nd Part: I'll need to right trigger to update CUS_TOTAL_DISTANCE to reflect any change to charter distance, including delete, insert, and/or update. (must consider all possible cases).

Please I don't not want you to write me the code as I only need help to understand triggers and use of cursors..(so any help would really appreciate it)
Thanks!
Go to Top of Page
   

- Advertisement -