问题描述
我正在使用Sybase Power Designer从物理数据模型创建数据库(Sybase创建SQL文件).当我使用phpMyAdmin导入SQL文件时,出现以下错误:
I am using Sybase Power Designer to create a database from a physical data model (Sybase creates an SQL file) . When i import the SQL file with phpMyAdmin I have the following error:
有什么想法吗?该错误可能是由于物理模型上的错误而出现的,还是存在另一个问题?
Any ideas? Could this error appear due to errors on the physical model or there is another problem?
这是代码:
if exists(select 1 from sys.sysforeignkey where role='FK_ARTWORK_HAS_BUY') then
alter table artwork
delete foreign key FK_ARTWORK_HAS_BUY
end if;
推荐答案
您收到的错误来自MySQL.不管用于生成SQL的工具是什么,数据库似乎都是MySQL(或者,如果系统感到困惑并认为它们是MySQL,那么您的系统就会出现严重错误).
The error you are getting is from MySQL. Regardless of the tool used to generate SQL, the database seems to be MySQL (or something is terribly wrong with your systems if they are confused and think they are MySQL).
MySQL if
语句(在此处记录)必须在存储的程序中.这意味着该代码仅在存储过程,用户定义的函数或触发器内编译.它本身不能正常工作".
The MySQL if
statement (documented here) has to be inside a stored program. That means that this code only compiles inside a stored procedure, user defined function, or trigger. It doesn't "just work" on its own.
此外,MySQL没有sys
表.它使用information_schema
表.我最强烈的建议是使用适合您实际数据库的工具.如果使用的是生成Sybase的工具,请使用Sybase作为目标数据库.如果使用的是MySQL,请使用工具生成MySQL代码.或者,更好的是,学习如何自己编写命令.
In addition, MySQL doesn't have sys
tables. It uses information_schema
tables. My strongest suggestion is to use tools appropriate for your actual database. If you are using a tool to generate Sybase, then use Sybase as the destination database. If you are using MySQL, then use a tool to generate MySQL code. Or, better yet, learn how to write the commands yourself.
最后,如果您打算使用Sybase,请连接到正确的数据库,然后应解决您的问题.
Finally, if you intend to use Sybase, then connect to the correct database and your problem should be fixed.
这篇关于#1064-您的SQL语法有误;检查与您的MySQL服务器版本相对应的手册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!