Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column Default Values and Stored Procedure

Status
Not open for further replies.

SauerC

Technical User
Joined
Apr 10, 2001
Messages
47
Location
US

Is it possible to have a stored procedure as the default value of a column?

we have a company table that we want to keep any revisions to the rec in the same table. We have a field called 'change_ind' which is set to null for the most current record. On an update, the record will be copied into a new row, the change_ind on the old record is set to a non-null value and the updated data is written to the new record.

The table also has an ID field...we want the ID number to stay the same between updates, so we can't use an identity field. It would be nice if the ID field could have a default value be a stored procedure...because then if we don't provide an ID, the stored procedure would go out and find the "one up" number and assign it.

Any ideas?

-Christian
 
I'm not aware that a SP can be a default value of a column.

Sounds like what might work for you is an UPDATE Trigger on the table, which on an update could insert the new row for you. Or else perhaps an INSERT trigger, which on an insert could go and update the old row.

vperry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top