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

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
LVL 2
davidi1Asked:
Who is Participating?
 
tigin44Connect With a Mentor Commented:
sory I missed a point... try this

ROUND(CAST(coulumnName AS FLOAT), 2)
0
 
tigin44Commented:
use
ROUND(coulumnName, 1)
0
 
davidi1Author Commented:
Bingo. Thank you
0
 
sshah254Commented:
try convert(decimal(10,2), waittime)

Ss
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.