Solved

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

Posted on 2011-03-14
4
1,147 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

786 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