Using sql-server: SQL query for finding first missing sequence string (prefix+no) on newest questions tagged sql-server – Stack Overflow
T-SQL query for finding first missing sequence string (prefix+no)
Sequence can have a prefix + a continuing no.
ex sequence will be
ID
-------
AUTO_500
AUTO_501
AUTO_502
AUTO_504
AUTO_505
AUTO_506
AUTO_507
AUTO_508
So above the missing sequence is AUTO_503 or if there is no missing sequence then it must return next sequence.
Also starting no is to specified ex. 500 in this case and prefix can be null i.e. no prefix only numbers as sequence.
See Answers
source: http://stackoverflow.com/questions/11598669/sql-query-for-finding-first-missing-sequence-string-prefixno
Using sql-server: using-sql-server
Recent Comments