gpt4 book ai didi

c++ - 为什么 SQLite 不让我查询特定的 ATTACHED 数据库?

转载 作者:太空狗 更新时间:2023-10-29 21:27:16 24 4
gpt4 key购买 nike

SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> ATTACH DATABASE 'test.db' AS 12;
sqlite> SELECT * FROM ids;
1|hi
2|hilo
3|hiloa
4|hiloas
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main
2 12 C:\test.db
sqlite> SELECT * FROM 12.ids;
Error: unrecognized token: "12.ids"

为什么会报错?数据显然在那里。

最佳答案

SELECT * FROM `12`.ids;

如果你打算使用奇怪的名字(比如全数字的名字),你最好正确地转义它们。

关于c++ - 为什么 SQLite 不让我查询特定的 ATTACHED 数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9440184/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com