user2057574
user2057574

Reputation: 799

What are the legal chars allowed in sql varchar?

I want to store a string in my table. The string will contain several substrings with a delimiter, the char ",".

Does varchar fit?

Upvotes: 0

Views: 5231

Answers (2)

mvp
mvp

Reputation: 116197

VARCHAR will work for you. But it does not mean that this is the right way to do it.

You should consider creating schema that stores each sub-string in separate row or column. This way data will be easier to read, write and, most importantly, search.

Upvotes: 1

Emil Vikström
Emil Vikström

Reputation: 91942

Yes, VARCHAR is the preferred datatype to store strings.

Storing multiple values in the same field is not preferred, however. A multivalued attribute is usually implemented as a table in the database design.

Upvotes: 3

Related Questions