【问题标题】:MYSQL - insert a variable into a stringMYSQL - 将变量插入字符串
【发布时间】:2019-04-12 00:10:43
【问题描述】:

我创建了 2 个变量

SET @SG_Positivity = 1600000000000027;
SET @SG_Relationship = 1700000000000027;

我想在我的 INSERT 的字符串中使用这些

INSERT INTO `core`.`card_config` (`version`,`scoring_model_id`,`locale_id`,`card_type`,`config`,`company_interview_id`)
VALUES('1',@ScoreModelID,'1','TTC','{"'+@SG_Positivity+'":{"summary":Tailored, personalized care"'+@SG_Relationship+'":{"summary":Ability to move others to action',NULL);

执行语句时出现以下错误

警告代码:1292 截断不正确的 DOUBLE 值:'{"'

【问题讨论】:

  • 使用 CONCAT(...) 添加元素。 + 在 MySQL 中工作

标签: mysql


【解决方案1】:

插入core.card_config (version,scoring_model_id,locale_id,card_type,config,company_interview_id) VALUES('1',@ScoreModelID,'1','TTC','{""'+@SG_Positivity+'''":{"''summary":量身定制的个性化护理"'+@SG_Relationship+'":{ "summary": 促使他人采取行动的能力"', 空);

如果没有任何效果,请尝试上述解决方案,然后参考refer this for more information

【讨论】:

    猜你喜欢
    • 2017-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-05
    • 2019-02-08
    • 1970-01-01
    相关资源
    最近更新 更多