Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Autoincrement

Author  Topic 

rahulakacyrus
Starting Member

2 Posts

Posted - 2010-11-02 : 02:15:34
Hi,

I need some help with autogenerating numbers like SA0000001,SA0000002 etc..

Can mysql achieve this or is there any other software related methodology i need to incorporate to achieve this?

Ifor
Aged Yak Warrior

700 Posts

Posted - 2010-11-02 : 07:27:53
The simple way of doing this is to have an IDENTITY column and just add the SA and the zeros when you display. If you need something more involved then the following link may help:

http://sqlblog.com/blogs/paul_white/archive/2010/10/19/sequence-tables.aspx

ps I have just noticed that you mentioned mysql. This is a MS-SQL forum so you may get more relevant information on a site like dbforums.
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2010-11-16 : 08:08:24
is this a sql server question?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-11-16 : 09:20:29
Mysql will fill leading zeroes but you need to append 'SA'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -