In MS-SQL Server How to get tables columns with increment value with SQL Query Example

Category > MSSQLSERVER || Published on : Sunday, August 17, 2014 || Views: 8436 || Get tables columns with increment value with SQL Increment value of table increment value list of Get tables columns with increment value with SQL


Introduction:-

Here Pawan Kumar has explained, Get tables columns with increment value with SQL Snippet.

Description:-
In previous post I explained How can we copy data From one Table to another Table in MS-SQL Server, Get todays Day Name SQL server, how can we convert negative a number to positive number in SQL Server 2005/2008.

article I will explain you how to get increment value colums of all the databse tables. In real world, the databases are very huge and it is very difficult to identify which table and which column has the increment value and what is current value of that particular column.

To get the right result, we can use the following SQL Query which can help us to get increment value colums of all the databse tables

You can use following script which will return with the table and column details who has having increment values.

 SELECT   OBJECT_NAME(OBJECT_ID) AS TABLENAME,
         NAME AS COLUMNNAME,
         SEED_VALUE,
         INCREMENT_VALUE,
         LAST_VALUE,
         IS_NOT_FOR_REPLICATION
FROM     SYS.IDENTITY_COLUMNS
ORDER BY 2

See the output:-

get-tables-columns-with-increment-value-with-sql

Conclusion:-
So in this way you can get tables and columns with increment value from sql.

 
Changed by 1 minute ago

Download Source Codes