我想把自己为nvarchar的字段数据转换成float
------解决方案--------------------
- SQL code
create function dbo.f_ntof(@n nvarchar(100))returns floatasbegin return (case when isnumeric(@n)=1 then convert(float,@n) else null end)endgoselect dbo.f_ntof('xx'),dbo.f_ntof('20.3');
------解决方案--------------------
alter table 表名 alter column 字段名 float
------解决方案--------------------