on 2019 Mar 29 9:08 AM
Hi all, Which data type is best used for a text field (about 2 kbyte size) in an SQL Anywhere database? The length of the text field will be variable. Regards from Bavarian Franz
Request clarification before answering.
See that question varchar vs. long varchar with a profound discussion on the consequences of "real long strings".
Besides that, SQL Anywhere does not distinguish CHAR from VARCHAR (in contrast, say to ASE or MS SQL Server, which treat CHAR as strings with a fixed length and blank-padding), so all strings are variable in length by design. Therefore from a database point of view, it doesn't matter if you use VARCHAR(20) or VARCHAR(20000) when your strings are all at most 20 characters long, the required space will be the same. (Of course, if you know strings are short because of business rules, it is IMHO helpful to limit the declared size, too.)
Of course, there's also the choice between unicode strings (aka NVARCHAR) vs. multi-byte strings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for Multi Byte collations like UTF-8 the usage of varchar(20 char) is more intuitive as Chars are counted not Bytes.
User | Count |
---|---|
52 | |
6 | |
5 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.