MySQL 查询语句错误
我正在尝试熟悉 Mysql 语法。到目前为止我只使用过MSSQL。我下载了 MySQL 查询浏览器并安装了 MySQL 版本 5.1
我想在 MySQL 的结果集选项卡中运行这行代码,但我不断遇到以下错误
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行“declare iCtr int”附近使用的正确语法
代码:
declare iCtr int;
set iCtr = 1;
while iCtr < 1000
begin
insert into employee (emp_id,emp_first_name,emp_last_name,status_id)
values (iCtr, 'firstName' + iCtr, 'lastName' + iCtr, 1)
set iCtr = iCtr + 1;
end
我只想填充我的员工表,但我无法通过 MySQL 语法。
I am trying to acquaint myself on Mysql syntax. I only have used MSSQL so far. I downloaded the MySQL Query Browser and have installed the MySQL Version 5.1
I wanted to run this line of code in the resultset tab of MySQL but I keep on encountering below error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'declare iCtr int' at line 1
Code:
declare iCtr int;
set iCtr = 1;
while iCtr < 1000
begin
insert into employee (emp_id,emp_first_name,emp_last_name,status_id)
values (iCtr, 'firstName' + iCtr, 'lastName' + iCtr, 1)
set iCtr = iCtr + 1;
end
I just wanted to populate my employees table but I cannot get past the MySQL syntax.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自: http://dev.mysql.com/doc/refman/5.0 /en/declare.html
我想这可能是麻烦所在?
from: http://dev.mysql.com/doc/refman/5.0/en/declare.html
I think that might be the trouble?
尝试
try