Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 varchar to bigint conversion

Author  Topic 

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2005-03-15 : 11:50:28
Guys,
I have situation here where I am trying to add a computed column to the existing table

alter table instruments add columna as substring(date_recorded, 7, 4)+substring(date_recorded, 1, 2)+
substring(date_recorded, 4,2)+'10'+substring(instr_nbk, 2, 7)

I want to convert this column to bigint when I try to convert clause in the alter table statement itself it goes through, but whenever I try to query the table 'Error converting data type nvarchar to bigint.'

Is there any I can convert varchar to bigint or if there is anyother way I can work around it to convert it to bigint in the alter table statement itself

Any inputs/suggestions would be very helpful

Thanks

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-03-15 : 12:36:04
your data must have non-numeric characters in it, so it cannot convert. Did you verify that the expression you have entered always results in a legal bigint value for existing values in this table?

- Jeff
Go to Top of Page
   

- Advertisement -