custom numbering field based on year sql 2008

i would like to have a field that will be primary key for the table and to have the format yyyy/0000000
Each year i want to start over from the 0000001

2010/0000001, 2010/0000002, 2010/0000003, 2010/0000004, ....
2011/0000001, 2011/0000002, 2011/0000003, 2011/0000004, ....
2012/0000001, 2012/0000002, 2012/0000003, 2012/0000004, ....
can i have your help??
more ▼

asked Aug 03, 2012 at 10:34 AM in Default

yiotaa gravatar image

0 1 1

(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Aug 03, 2012 at 10:34 AM

Seen: 396 times

Last Updated: Aug 03, 2012 at 10:47 AM