|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
How can I acomplish that?
I want a field in my table to autoincrement like 'CHD0001', 'CHD0002', 'CHD0003' thanks! |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Fabio wrote:
> How can I acomplish that? > > I want a field in my table to autoincrement like 'CHD0001', 'CHD0002', > 'CHD0003' > > thanks! Why does the CHD prefix need to be there? Will it ever change? If not it's unnecessary. It can be generated when you query the column or with a view. If yes, it should be a separate column. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Fri, 18 Apr 2008 11:31:54 -0700 (PDT), Fabio wrote:
> How can I acomplish that? > > I want a field in my table to autoincrement like 'CHD0001', 'CHD0002', > 'CHD0003' Can't do it straight. Can CONCAT('CHD', CAST(my_id as CHAR)) on select though, where my_id is your autoincrement, zerofill int(5) column. -- 76. If the hero runs up to my roof, I will not run up after him and struggle with him in an attempt to push him over the edge. I will also not engage him at the edge of a cliff. (In the middle of a rope-bridge over a river of molten lava is not even worth considering.) --Evil Overlord List |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Chuck:
> Fabio wrote: > > > > I want a field in my table to autoincrement like 'CHD0001', 'CHD0002', > > 'CHD0003' > Why does the CHD prefix need to be there? Will it ever change? > > If not it's unnecessary. It can be generated when you query the column > or with a view. If CHD is there for presentational purposes only, I would prefer putting it into the presentation (or logic) layer instead of using the database to do that. -- Erick |
|
![]() |
| Outils de la discussion | |
|
|