?
Solved

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

Posted on 2011-03-14
4
Medium Priority
?
1,167 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 2000 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

752 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