Click here to Skip to main content
15,908,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
ALTER TABLE tablename ALTER COLUMN columname datatype


is not working

What I have tried:

SQL
ALTER TABLE purchaserequestdetail ALTER COLUMN quantity float
Posted
Updated 24-Jul-16 21:04pm

1 solution

try this
Replace the non numeric values to Null and then try to alter the type.
SQL
update purchaserequestdetail set quantity =  case   ISNUMERIC(quantity) when 1 then quantity else null  end  
ALTER TABLE purchaserequestdetail ALTER COLUMN quantity float


Note : Take a backup of the table before updating.
 
Share this answer
 
Comments
neeraj_ 25-Jul-16 3:32am    
thanks sir
but not working
Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to float.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900