Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bigint vs char(10) column decision
Message
De
18/05/2021 15:39:00
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
01680563
Message ID:
01680576
Vues:
29
J'aime (1)
If you're not going to add it, subtract it, divide or multiply with it, or use it as a PK - character. Other reasons may include:
1) Consistency across the DB
2) if, for whatever reason, the source of the column decides to add letters to it, you don't have to re-define the field
3) You won't lose any preceding zeros from it.

my opinion, and worth every penny you're paying for it

>Hi everybody,
>
>I'm trying to make a right choice for the new table design. It is going to have only few columns one being its primary key and it's a 10 digit number. I'm thinking that BIGINT is a good choice for this column, but my colleagues are arguing that most of other tables that have the same column use either char(10) or varchar column. I found that we're very inconsistent in the length of that column and we even have a few tables using INT for this column (or nchar/nvarchar).
>
>Anyway, what do you think the correct decision should be - the table is new and it is supposed to be relatively small (perhaps ~1K rows in total at most). I already designed it using BIGINT for the PK, but given the fact that many of the tables already use char for the same purpose, should I probably switch to char(10) instead?
>
>Thanks in advance.
>
>----------------------------
>BTW, we may want to add SQL Server 2019 and SQL Server 2017 as other versions available.
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform