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.
| Author |
Topic |
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2009-09-15 : 22:02:00
|
| hiHow do i auto generate customer id? For example, C000001,C000002,C000099I am using Nvarchar(50) for CustID field |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2009-09-16 : 08:53:08
|
| [code]create table computed ( incr int not null identity(1, 1), computed as ('C' + right(cast((100000000 + incr) as varchar(9)), 8)) persisted not null primary key clustered, fistname varchar(25) ) insert into computed (fistname) select 'Lumbago'select * from computed[/code]- Lumbago |
 |
|
|
|
|
|