Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

What is the syntax to convert Nvarchar(255) into numeric data type in SQL??

Thanks,
DhivyaJ
Posted
Comments
vijay__p 9-May-13 1:35am    
What you want to convert single value or whole column DataType in table?
Dhivya.J 9-May-13 1:36am    
Thank you. I have to convert whole column.
vijay__p 9-May-13 1:55am    
Check my answer below
Dhivya.J 9-May-13 2:25am    
Thank you.

cast (FIELDNAME as int)
 
Share this answer
 
Try this:
SQL
CONVERT(NUMERIC(18, 2), YourData)

Or
SQL
CASTE(YourData as NUMERIC(18, 2))

I would suggest you to read Data Type Conversion (Database Engine)[^] and CAST and CONVERT (Transact-SQL)[^] functions.


Hope it helps!
--Amit
 
Share this answer
 
Do yourself a big favor: don't convert, avoid using string types where you should use numeric types.

—SA
 
Share this answer
 
Try below query against your table and particular column

SQL
ALTER TABLE TableName ALTER COLUMN ColumnName INT NULL
 
Share this answer
 

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