简体   繁体   中英

How can I show the zero at the starting of a number in SQL/Sybase?

I want to put two totally different numbers like 01234567890 and 1234567890 So I made this code on SQL/Sybase

create table DOCTORS(
    document bigint not null ,
);
GO

Insert into DOCTORS values(CONVERT(INT, '01234567890'))

Insert into DOCTORS values(CONVERT(INT, '1234567890'))'

But when I do a select , it shows me:

document
--------
1234567890
----------
1234567890

instead of

document
--------
01234567890
----------
123456789

BIGINT values represent a spot on the number line.

1234567890 = 01234567890 = 1234567890.000

To make these values differentiate from each other, they cannot be any sort of a numeric data type.

Strings, however, can make this differentiation.

'1234567890' != '01234567890' != '1234567890.000'

Make the data type nvarchar(max) to accomplish the differentiation you seek.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM