Click here to Skip to main content
12,627,681 members (31,876 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked

How to convert nvarchar, money and smallmoney values to int

, 24 Jun 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
This tip enables you to convert nvarchar, money and smallmoney values to int.
Simply, we can use the given conversion syntax to convert Nvarchar, smallmoney and money datatype values to int values.

select (CAST(CAST(ColumnName AS float) AS INT))
select (CASE WHEN ISNUMERIC(ColumnName)=1 THEN CAST(CAST(ColumnName AS float) AS INT)END )


Create a table and insert values as:
create table payment(id varchar(5),amount nvarchar(15))
insert into payment values('E001',5000.00)
after that out of "select * from payment" will be
id amount
--- --------
E001 5000.00

Using Syntax, write code as:
select (CAST(CAST(amount AS float) AS INT)) from Payment
Output for amount columns will be:


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


About the Author

Ravi Ranjan Kr
Software Developer
India India
Microsoft Student Partner | CS Student | MCTS | CP MVP | Crazy Learner | Dreamer

An Indian, who loves his country, believes in freedom, He is an enthusiast Techie and crazy learner. He is passionate about Technologies and social media. He holds bachelor degree of CS in Information Technology and now pursuing Master degree in Computer Application.

He always excited and keen Interested in learning and sharing knowledge. He loves to write blog, learn new things, listen music, taking arts and Playing Games..

He keep himself on the desk of his imagination, hanging around with some inceptions.

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161205.3 | Last Updated 24 Jun 2011
Article Copyright 2011 by Ravi Ranjan Kr
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid