Tuesday, February 19, 2019

SQL Server - Reset Table Identity Value and Insert

1. DBCC CHECKINDENT RESEED can be used to reset a tables identity value on a column.
Syntax: DBCC CHECKIDENT ('[Table_Name]', RESEED, 0);
This command will reset the identity column value to '0'.2. SET Identity_insert - allow inserting explicit values into the identity column of a table. The IDENTITY_INSERT statement must be set ON to insert explicit value for the identity column.
Syntax: SET IDENTITY_INSERT [dbo].[Table_Name] ON ;
Identity insert should be set to 'OFF' after insertion. To off identity insertion use following command.
Syntax: SET IDENTITY_INSERT [dbo].[Table_Name] OFF ;

Thursday, October 26, 2017

Sunday, February 26, 2017

How to Post code snippets in Blogger

I had a lot of pain finding a easy way to post code snippets in blogger. After a lot of searching found a easy way. Here it is.
  1. Go to gist.github.com
  2. Write a description (Optional)
  3. Write a file name including extension. Without extension syntax will not be highlighted.
  4. Add your code, which you want to post in blogger.
  5. Now click "Create Public Gist" button.

Saturday, February 25, 2017