How to insert values into Identity columns
Identity field is system generated key value for the table and it is mostly the primary key. While inserting a new record into your table, this field automatically assign an incremented value by looking at the previous value. There may be situation you want to manually enter the key value without resorting on the automatic process. Normally we create -1 key value in the world of Dimensional modelling with DIM and FACT tables. Dimension tables with -1 Dimkey can be manually created for the purpose of identifying the non-exiting records while processing the FACT tables.
The following SQL code will INSERT a record with the DIMKEY column with -1
What do you think?
I hope you enjoy the tip in this blog. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.