Solved

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

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

792 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