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 |
|
slaurent
Starting Member
6 Posts |
Posted - 2004-06-10 : 10:31:48
|
| Hi All,I need to store a customer number which is a 19 digits number.What will be the best to use performance wise when querying on the customer number? a bigint or a varchar (i have a clustered index on the field)? ThanksStephanie |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-06-10 : 10:36:27
|
| bigint will be quicker if you are retrieving or joining on the field... |
 |
|
|
JasonGoff
Posting Yak Master
158 Posts |
Posted - 2004-06-10 : 10:36:58
|
| a BIGINT has a maximum value of 9223372036854775807, so if your cust number can exceed that, it's no good. Have you considered using NUMERIC(19,0) ? Would be better than a varchar. |
 |
|
|
slaurent
Starting Member
6 Posts |
Posted - 2004-06-10 : 10:39:25
|
good point!will check that.Thanksquote: Originally posted by JasonGoff a BIGINT has a maximum value of 9223372036854775807, so if your cust number can exceed that, it's no good. Have you considered using NUMERIC(19,0) ? Would be better than a varchar.
|
 |
|
|
steelkilt
Constraint Violating Yak Guru
255 Posts |
Posted - 2004-06-10 : 12:16:32
|
| also I'd steer clear of varchar altogether unless you want to write extra data validation rules up front to prevent users from entering non-numerics in the db.If it's a number, then stick with some sort of numerical data type, I vote.cheers |
 |
|
|
steelkilt
Constraint Violating Yak Guru
255 Posts |
Posted - 2004-06-10 : 12:17:23
|
| also I'd steer clear of varchar altogether unless you want to write extra data validation rules up front to prevent users from entering non-numerics in the db.If it's a number, then stick with some sort of numerical data type, I vote.cheers |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-06-10 : 12:24:59
|
| If your not going to do math on it's char(19) or varchar(19)Is SSN a number?Brett8-) |
 |
|
|
|
|
|