Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mysql使用随机数生成器更新错误_Mysql - Fatal编程技术网

mysql使用随机数生成器更新错误

mysql使用随机数生成器更新错误,mysql,Mysql,我有下面的查询,它生成一个随机数,然后将xxxx附加到它。 然后我将其更新到该列 UPDATE users SET profile_name = concat( "xxxxx" , CONVERT(varchar(240), FLOOR( 7 + ( RAND( ) * 9999999 ) ) ) ) 它抛出了下面的错误 #1064 - You have an error in your SQL syntax; check the manual that corresponds to you

我有下面的查询,它生成一个随机数,然后将xxxx附加到它。 然后我将其更新到该列

UPDATE users SET profile_name = concat( "xxxxx" , CONVERT(varchar(240), FLOOR( 7 + ( RAND( ) * 9999999 ) ) ) )
它抛出了下面的错误

 #1064 - 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 'varchar(240), FLOOR( 7 + ( RAND( ) * 9999999 ) ) ) )' at line 1

错误是什么

我认为这是您想要的可执行文件:-

SELECT CONCAT( "xxxxx" , CONVERT(FLOOR( 7 + ( RAND( ) * 9999999 ) ), CHAR ) )
试试这个:

UPDATE users SET profile_name = concat("xxxx", FLOOR(7 + RAND() * 9999999))

CONVERT函数的语法是
CONVERT(值、类型)
。请更正。请看,您可以删除转换功能,只需离开
updateuserssetprofile\u name=concat(“xxxxx”,FLOOR(7+(RAND()*999999)))