Posted by AlterEgo on 01/24/07 23:16
Handerson,
If you set up a column as an INTEGER IDENTITY column (see BOL), SQL Server
will not store leading zeros. You could get leading zeros out of your select
statments as follows:
select right('00000000' + cast(MyColumn as varchar(25)), 8)
But, the best thing to do is manage leading zeros at the application layer.
Don't have the database always doing that work for you.
-- Bill
"HandersonVA" <handersonva@hotmail.com> wrote in message
news:1169678553.956380.205080@q2g2000cwa.googlegroups.com...
> will it be possible to increase number as below automatically
> 00000001
> 00000002
> 00000003
> ...
>
> whenever the row is inserted, number will be increased like above
> format.
> which data type should I select and do some other setting to record
> like that?
> thanks
>
[Back to original message]
|