Search code examples
sqlsql-serverreadonlycreate-table

SQL Column after insert read only without trigger


I have to create two columns (creator, creation date), which is after insert readonly. These two fields can't be changed after the insert. I know that is posible with sql-triggers to solve this requirement. but think this is not a comfortable solutuion.

Is there a solution to solve my "problem" with in the Create-Table-Statemant


Solution

  • Maybe the Column permission will work for you.

    DENY UPDATE ON dbo.MyTable (Creator, CreationDate) TO SampleRole;