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:
- Composite Primary Keys
- The problem isn't the poor database model; It's that external code is bound to the schema
- Distinguishing data from code
- Data Types -- The Easiest Part of Database Design
- SQL Data Modeling: Entities versus Attributes
- Don't Let Output Dictate your Database Design
- Data belongs in your tables -- not in your code
- Delete Duplicates And Resolve Foreign Key References in SQL
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 |