SQL Server 2005 - Setting a column as readonly

sql-server, sql-server-2005

Solution

Write a stored procedure to do the Update in this table, and make sure it doesn't touch the InsertTime field. Then set all your users' permissions so they can't themselves do a raw Update on this table, but can call the stored procedure.

Problem

I have a "InsertTime" field in a table in a SQL Server 2005 database which is defaulted to "getDate()" when the record is first inserted into the database. I want to ensure that this column is not updated again. Can this column be set to readonly or is there a better way to do this without writing all of the sql for the developers?

Original source

Related problems