保留十位有效数字

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

DECLARE @execsql NVARCHAR(1024)
SET @execsql =N'SELECT CAST('+CAST(125.365412354 AS NVARCHAR(20)) +N' AS NUMERIC (20,'+STR(10-CEILING(LOG10(125.365412354)))+N'))'
EXEC SP_EXECUTESQL @execsql