No, but you can create a trigger that updates the column whenever an
associated value changes. This will work on both updates and inserts if
you so wish.
Albert
On 16/10/2012 10:52 AM, Jason Kramer wrote:
Is it possible to use a Stored Procedure in a computed column?
I have an INTEGER column that I want to fill using a SP that
returns an INTEGER. The SP works if I run it from the command line,
but when I use it as a computed column, the column ends up storing
garbage. I am using (CALL lifetime(sdate,edate,'TOT')) as the
computer column definition. sdate and edate are columns in the table
that occur (and are populated) before the computed column, and 'TOT'
is a valid value for the SP.
If I change the column to be non computed, and add the SP call to
my INSERT INTO command (INSERT INTO mytable (sdate,edate,tot_life)
VALUES (10/16/2012,10/17/2012,(CALL
LIFETIME('10/16/2012','10/17/2012','TOT'))), the correct value is put
in the tot_life column.
Thanks,
Jason
--
Jason Kramer
University Archives and Records Management
002 Pearson Hall
(302) 831 - 3127 (voice)
(302) 831 - 6903 (fax)
No virus found in this message.
Checked by AVG - www.avg.com <http://www.avg.com>
Version: 2013.0.2741 / Virus Database: 2614/5835 - Release Date: 10/16/12