Jeff Smith Blog

Random Thoughts & Cartesian Products with Microsoft SQL Server

Custom Auto-Generated Sequences in SQL Server

Be sure to visit SQLTeam.com to check out my latest article, Custom Auto-Generated Sequences in SQL Server.  It addresses a common question we see in the SQL Team forums. 

From the intro:

This article by Jeff Smith covers different ways to create sequence numbers. It starts with the basic identity and GUIDs and quickly moves to much more complicated sequence numbers including those with auto-incrementing mixed letters and numbers such as "A0001", etc. Jeff shows one of the easiest ways I've ever seen to efficiently handle very odd sequence numbers.

In other words, if you want your database to assign customer numbers formatted like "AB-023" automatically, this is the article for you.

Enjoy!

see also:

Legacy Comments


George King Sr.
2007-05-19
re: Custom Auto-Generated Sequences in SQL Server
Stop calling yourself software developer, you're only PC scripting language user, as Microsoft wanted you to be.

Asit kumar bihari
2008-08-18
re: Custom Auto-Generated Sequences in SQL Server
please give me the autogeneration code in sqlserver inc#.net

Polelo
2009-09-11
re: Custom Auto-Generated Sequences in SQL Server
This is good