Declare @Random int = 1, @Bool bit = 0;
WHILE (@Bool = 0)
BEGIN
SET @Random = ROUND(RAND()*(SELECT MAX(CharID) FROM SRO_VT_SHARD_INIT.dbo._Char where LastLogout < DATEADD(DAY, -3, CURRENT_TIMESTAMP),0)
IF exists (SELECT CharID FROM SRO_VT_SHARD_INIT.dbo._Char WHERE CharID = @Random)
BEGIN
SET @Bool = 1 /*true*/
END
END
print @Random
它在CURRENT_TIMESTAMP
之后给出错误,表示逗号附近有语法错误。如果我删除了0,那么ROUND
函数没有足够的参数。有人?
答案 0 :(得分:2)
更改
CURRENT_TIMESTAMP),0)
到
CURRENT_TIMESTAMP)),0)