Big Data Series

SQL Server: INSERT values to IDENTITY column


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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s