SET IDENTITY_INSERT [table_name] ON
INSERT table_name (column_name1, columnname2, .....)
VALUES (value, value,.....)
SET IDENTITY_INSERT [table_name] OFF
*key points to ponder about IDENTITY_INSERT
INSERT table_name (column_name1, columnname2, .....)
VALUES (value, value,.....)
SET IDENTITY_INSERT [table_name] OFF
*key points to ponder about IDENTITY_INSERT
- It can only be enabled on one table at a time. If you try to enable it on a second table while it is still enabled on a first table SQL Server will generate an error.
- When it is enabled on a table you must specify a value for the identity column.
- The user issuing the statement must own the object, be a system administrator (sysadmin role), be the database owner (dbo) or be a member of the db_ddladmin role in order to run the command.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.