﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Sean Kotze  / Script to check current identity of Tables / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 18 Jun 2013 18:03:10 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Script to check current identity of Tables</title><link>http://www.sqlservercentral.com/Forums/Topic878379-2636-1.aspx</link><description>Oh yes ! you're right, thanks !</description><pubDate>Fri, 19 Mar 2010 09:51:20 GMT</pubDate><dc:creator>pmonschein</dc:creator></item><item><title>RE: Script to check current identity of Tables</title><link>http://www.sqlservercentral.com/Forums/Topic878379-2636-1.aspx</link><description>If any of your tables are at approx 99.995% or higher, the script errors out with:Msg 8115, Level 16, State 8, Line 1Arithmetic overflow error converting numeric to data type numeric....so you need to change as NUMERIC(4,2)) AS [PercentageUsed] toas NUMERIC(5,2)) AS [PercentageUsed] </description><pubDate>Thu, 18 Mar 2010 19:30:45 GMT</pubDate><dc:creator>WILLIAM MITCHELL</dc:creator></item><item><title>RE: Script to check current identity of Tables</title><link>http://www.sqlservercentral.com/Forums/Topic878379-2636-1.aspx</link><description>HelloYou script is using compatibility views. I prefer using dedicated views even if I need to have several version for different SQL Server version.Here is my SQL script for SQL Server 2005-2008 which source is from this site [url]http://vyaskn.tripod.com/sql_server_check_identity_columns.htm[/url]and that I have modified a little to manage 'numeric' and 'decimal' and use directly "sys.identity_columns" system views dedicated for this purposeRegardsPascal[code="sql"]---- liste les colonnes IDENTITY avec leur max current value et le taux d'usage en fonction du type choisi--SELECT    QUOTENAME(SCHEMA_NAME(tab.[schema_id])) + '.' +  QUOTENAME(tab.[name]) AS [TableName],    col.[name] AS [ColumnName],    typ.[name] AS [DataType],    col.[last_value] AS [CurrentIdentityValue],    col.[precision] AS [PrecisionValue],    CAST(ROUND(CASE col.[system_type_id]        WHEN 127 THEN (IDENT_CURRENT(SCHEMA_NAME(tab.[schema_id])  + '.' + tab.[name]) * 100.) / 9223372036854775807        WHEN 106 THEN (IDENT_CURRENT(SCHEMA_NAME(tab.[schema_id])  + '.' + tab.[name]) * 100.) / CONVERT(NUMERIC(38,0),REPLICATE(9,col.[precision]))        WHEN 108 THEN (IDENT_CURRENT(SCHEMA_NAME(tab.[schema_id])  + '.' + tab.[name]) * 100.) / CONVERT(NUMERIC(38,0),REPLICATE(9,col.[precision]))        WHEN 56  THEN (IDENT_CURRENT(SCHEMA_NAME(tab.[schema_id])  + '.' + tab.[name]) * 100.) / 2147483647        WHEN 52  THEN (IDENT_CURRENT(SCHEMA_NAME(tab.[schema_id])  + '.' + tab.[name]) * 100.) / 32767        WHEN 48  THEN (IDENT_CURRENT(SCHEMA_NAME(tab.[schema_id])  + '.' + tab.[name]) * 100.) / 255    END,2) as NUMERIC(4,2)) AS [PercentageUsed]FROM    sys.identity_columns AS col    INNER JOIN sys.tables AS tab ON tab.[object_id] = col.[object_id]    INNER JOIN sys.types AS typ ON col.[system_type_id] = typ.[system_type_id]WHERE    col.[is_identity] = 1ORDER BY    [PercentageUsed] DESC[/code]</description><pubDate>Thu, 18 Mar 2010 03:49:14 GMT</pubDate><dc:creator>pmonschein</dc:creator></item><item><title>RE: Script to check current identity of Tables</title><link>http://www.sqlservercentral.com/Forums/Topic878379-2636-1.aspx</link><description>[code="sql"]SELECT t.name, IDENT_CURRENT(t.name) FROM sys.tables tWHERE IDENT_CURRENT(t.name) IS NOT NULLORDER BY 1[/code]</description><pubDate>Wed, 17 Mar 2010 05:51:08 GMT</pubDate><dc:creator>WILLIAM MITCHELL</dc:creator></item><item><title>Script to check current identity of Tables</title><link>http://www.sqlservercentral.com/Forums/Topic878379-2636-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/IDENTITY/69736/"&gt;Script to check current identity of Tables&lt;/A&gt;[/B]</description><pubDate>Sun, 07 Mar 2010 18:29:00 GMT</pubDate><dc:creator>Goofy</dc:creator></item></channel></rss>