Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Identity Problem
Message
General information
Forum:
ASP.NET
Category:
Databases
Miscellaneous
Thread ID:
00726176
Message ID:
00726192
Views:
15
This message has been marked as the solution to the initial question of the thread.
You will not be able to use the identity column for SQL Server, since it will determine the ids. But if you want the functionality to determine a missing id in a column that is in numeric order then you can use the following select statement as a guideline:

The following will return the lowest missing id_field value:
SELECT MIN(id_field) + 1 AS id_field
FROM MyTable a
WHERE NOT EXISTS
    (
    SELECT *
    FROM MyTable b
    WHERE b.id_field = a.id_field + 1
    )
>hi , every body
>
>i want watch on identity column, i meant to say that if any column delete from table which has identity column, when new column add check identity column that any number is missing if then insert that missing number if not then continue with next number.
>
>E.g 1,2,3,4
>
>Now i delete 2 no column , When new column add it will be 2, if no column delete then next will be 5
>
>Thanks
>Mufi
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform