List:General Discussion« Previous MessageNext Message »
From:Daniel Kasak Date:January 3 2006 9:14pm
Subject:Re: MySql 5 replacement for computed default column value
View as plain text  
Harald Fuchs wrote:

>In article <43B99C1E.8080401@stripped>,
>Daniel Kasak <dkasak@stripped> 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: dkasak@stripped
website: http://www.nusconsulting.com.au
Thread
MySql 5 replacement for computed default column valueBryan Cantwell2 Jan
  • Re: MySql 5 replacement for computed default column valueDaniel Kasak2 Jan
  • Re: MySql 5 replacement for computed default column valueHarald Fuchs3 Jan
    • Re: MySql 5 replacement for computed default column valueDaniel Kasak3 Jan