错误 SQL查询:
UPDATE `wfg_db`.`employee` SET `DOB` =
(DECLARE@mm INT
DECLARE@xm INT
SET @mm =1
SET @xm =13
DECLARE@md
INT DECLARE@xd
INT SET @md =1
SET @xd =29
DECLARE@my INT
DECLARE@xy INT
SET @my =1900
SET @xy =2009 SELECT CAST( CAST( (
@xm - @mm
) * RAND( ) + @mm AS INT ) AS VARCHAR( 2 ) ) + '/' + CAST( CAST( (
@xd - @md
) * RAND( ) + @md AS INT ) AS VARCHAR( 2 ) ) + '/' + CAST( CAST( (
@xy - @my
) * RAND( ) + @my AS INT ) AS VARCHAR( 4 ) ) AS DATE )
WHERE `employee`.`id`
MySQL说:
#1064 - 您的SQL语法出错;检查手册 对应于您的MySQL服务器 用于正确语法的版本 'DECLARE @mm int DECLARE @xm int附近 SET @mm = 1 SET @xm = 13 DECLARE @md int'在第1行
答案 0 :(得分:2)
这可以满足您的需求吗?
UPDATE `wfg_db`.`employee` SET `DOB` =
cast(ADDDATE('1900-01-01',rand()*40176) as date)
/* WHERE `employee`.`id` = What?*/