orangesql
orangesql

Reputation: 3

What data type should I use for both letters and numbers in a same column?

I want to insert into a table values that contain both letters and numbers (like 'CL005' for example).

What data type should I use for my attribute ? 'number' doesn't work.

Thanks in advance !

Upvotes: 0

Views: 12094

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1271151

You have no choice in most databases. You need to use a string. I would recommend varchar() of some sort.

Some databases support a "variant" type that can hold different types. To be honest, this is very rarely used.

Upvotes: 1

Related Questions