Harald Fuchs wrote:
In article <[EMAIL PROTECTED]>,
Daniel Kasak <[EMAIL PROTECTED]> writes:
Bryan Cantwell wrote:
Trying to migrate to MySql 5 from Sybase asa. I have a tables that
have column values that are calculated based on other columns in the
table. How can I accomplish the same in MySql?
This sounds a job for a trigger - an insert trigger.
I haven't used triggers in mysql, so I can't help you with exactly how
to do it.
If SELECT performance is good enough, a VIEW would probably be easier.
The advantage of a trigger is that it only runs when the data is
inserted ( and possibly updated ). Depending on the use of the database,
you may have a situation where the data is inserted and then selected
from multiple times - that's at least the usage pattern we have here. In
this case, you're better off with a stored procedure.
Also keep in mind that the title of the post said 'default', indicating
that the fields in question might take on a different value to the
calculated one.
--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]