mysql命令行不能粘贴_将SQL粘贴到MySQL命令行中

bd96500e110b49cbb3cd949968f18be7.png

I have an application that is defining some SQL code:

mySql = "SELECT

sq.question,

qs.title,

sq.id as question_id,

sq.type,

qs.id as option_id,

sri.title as rankTitle,

sri.id as rankId,

sfi.title as formTitle,

sfi.id as formId,

sq.sub_type,

sq.sort_order

FROM survey_questions as sq

LEFT JOIN question_suboptions as qs

ON sq.id = qs.question_id

LEFT JOIN survey_rankingitems as sri

ON sq.id = sri.question_id

LEFT JOIN survey_formitems as sfi

ON sq.id = sfi.question_id

WHERE sq.survey_id = #{@surveyId}

ORDER BY sq.sort_order"

I would like to paste this code (everything between the double quotes) in the MySQL command line, change the one parameter and execute it, but I have run into an issue where for every line above MySQL will display:

Display all 1450 possibilities? (y or n)

And then 1450 different available commands. If I remove all linebreaks and tabs then I can paste in, but that is time consuming and a pain. Is there a way that I can simply paste in the above code, edit it and then execute it as a single unit?

解决方案

Perhaps you could save the statement to a text file myTest.sql, then use the MySQL command source myTest.sql to run it? You could then tweak the SQL in the file, save the changes, and run it again.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值