我在 SQLite 中制作了一张表,并为一个字段选择了 varchar(30),但似乎我实际上可以保存更长的字符串,这正常吗?谁能给我解释一下?
最佳答案
是的,这很正常,并在 documentation 中进行了解释:
Note that numeric arguments in parentheses that following the type name (ex: "VARCHAR(255)") are ignored by SQLite - SQLite does not impose any length restrictions (other than the large global SQLITE_MAX_LENGTH limit) on the length of strings, BLOBs or numeric values.
(请注意,在看到这个问题之前,我对此一无所知。首先检查文档总是值得的。)
关于C# 和 Sqlite 字段长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18002111/