Solved

SQL - Query Help - Convert Varchar to numeric / decimal(10,2)

Posted on 2011-03-14
4
1,158 Views
Last Modified: 2012-08-14
Team,

I have 2 columns, Waittime & Sessiontime - both are Varchar(255)

it has values like 1.23545578. I have cross checked the entire table. It doesnt have any non-numeric value.

How can I limit the value to decimal(10,2).

When I cast the column as decimal, it throws "Error converting data type varchar to numeric."

Pls help
0
Comment
Question by:davidi1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 26

Expert Comment

by:tigin44
ID: 35133533
use
ROUND(coulumnName, 1)
0
 
LVL 26

Accepted Solution

by:
tigin44 earned 500 total points
ID: 35133552
sory I missed a point... try this

ROUND(CAST(coulumnName AS FLOAT), 2)
0
 
LVL 2

Author Closing Comment

by:davidi1
ID: 35133554
Bingo. Thank you
0
 
LVL 9

Expert Comment

by:sshah254
ID: 35133563
try convert(decimal(10,2), waittime)

Ss
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question