Inspect your data !
Your example works perfect as shown next.
create table #mytb1 (col1 nvarchar(50) not null);
insert into #mytb1
Select '500910000000000000'
union all Select '500903000000000000'
union all Select '500909000000000000'
union all Select '500903000000000000'
union all Select '500805000000000000'
union all Select '500911000000000000'
union all Select '500905000000000000'
union all Select '500911000000000000'
union all Select '500905000000000000'
union all Select '500911000000000000';
-- (10 row(s) affected)
Alter table #mytb1
add colnew bigint null ;
go
update #mytb1
set colnew = cast( col1 as bigint )
where colnew is null ;
-- (10 row(s) affected)
drop table #mytb1;
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me