July 29, 2008 at 4:13 am
Hello,
I have created a table in SQL Server 2005 with some columns and inserted the records. Now I would need to alter a column datatype from varchar to numeric..
i have used the following query,
alter table DD_TSC_ITEM_OTHERINFO_DETAILS alter column DVD_FORMAT numeric(18,0)
but when i run it, error is occuring as below,
Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.
The statement has been terminated.
Please guide me how to solve and alter the data type of the column. Can u please the syntax of the query used.
Do reply ASAP.
Thanks
July 29, 2008 at 4:33 am
The above message means that some of the values in your table cannot be converted to the new data type. For example you may have 'foo' as a value, and SQL Server struggles to turn this into a numeric(18.0) value.
To find out if some values are not numeric you can do the following:
SELECT DVD_FORMAT
FROM DD_TSC_ITEM_OTHERINFO_DETAILS
WHERE ISNUMERIC(DVD_FORMAT) = 0
You then need to fix these, and try to change the type after the values have been updated.
Regards,
Andras
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply