declare @myTab table( ExtRef varchar(9), IntRef decimal(38,19))
insert into @myTab(ExtRef,IntRef) values ('1',0)
insert into @myTab(ExtRef,IntRef) values ('2.1',0)
insert into @myTab(ExtRef,IntRef) values ('A',0)
update @myTab
set IntRef = case when isnumeric(ExtRef) = 1 then ExtRef else -1
--(A)
end
update @myTab
set IntRef = case when isnumeric(ExtRef) = 1 then ExtRef else -1
--(A)
end
Confused here --(A) is a comment, yes?
The cast to decimal would be required otherwise a failure converting varchar to decimal.
Jamie