We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,949 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Auto update columns?

Hi! Can anyone please provide me with a little bit of information regarding this subject? I think I've heard from a lecturer that there is a command to auto-update the entries of a table. For example, when a new record is inserted, the salary column would be auto-inserted with (rough_salary - tax_rate) without having the user to key in the salaries. In case, it is trigger you are thinking of, I don't think that is it. Anyone get me? Thanks.

3
Contributors
4
Replies
1 Week
Discussion Span
9 Years Ago
Last Updated
5
Views
red_evolve
Posting Whiz
313 posts since Jun 2003
Reputation Points: 53
Solved Threads: 1
Skill Endorsements: 0

Well to my knowledge of SQL or Access for that matter. It would be a trigger that does something like that. There is no other way to update a column automatically via a calculation without using a trigger.

So I would be extremely surprised that there is another way. Stored Procedures or Triggers is the only method I know of.

Sorry if that was of no help!

Paladine
Master Poster
Team Colleague
824 posts since Feb 2003
Reputation Points: 211
Solved Threads: 27
Skill Endorsements: 0

Umm...thanks a lot anyway. Actually, I am supposed to create a data warehouse. Knowing that data warehouse has all the following characteristics: non-volatile, time variant, integrated, subject-oriented; which is why trigger was not allowed by my lecturer.

red_evolve
Posting Whiz
313 posts since Jun 2003
Reputation Points: 53
Solved Threads: 1
Skill Endorsements: 0

OK...but how does that affect the use of Trigger?

You say time variant (trigger is not), non-volatile (huh?), subject oriented (nothing to do with a trigger). So I am confused as to how else you can do it.

For interest sake, I would love to know...truly love to know, how else you would ever do it.

Paladine
Master Poster
Team Colleague
824 posts since Feb 2003
Reputation Points: 211
Solved Threads: 27
Skill Endorsements: 0

My only idea would be to perform your calculations using a web based (PHP, CGI, ASP, etc) script to re-evaluate any fields that may need adjusting due to changing data in another field.

I guess it would all depend on the DB, the interface, and options available. The only ones I've worked with have been SQL systems that are accessable to a web-based script.

As far as a field that is automatically updated by the db itself by simply updating another field... I'm clueless. ;)

himerus
Junior Poster in Training
84 posts since Aug 2003
Reputation Points: 11
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0577 seconds using 2.53MB