x

Convert Text to decimal.

how to handle below error,

Operand type clash: text is incompatible with decimal

i must data trans for text datatype to decimal data type. in first table all values are decimals.

more ▼

asked Apr 17, 2012 at 05:24 AM in Default

avatar image

prasad.nyalapatla
100 8 11 15

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

I would suggest you stop using the text datatype and instead use the varchar(max) datatype.

But to cast from text to decimal you'll have to go over a varchar. Like this:

 SELECT CAST(CAST(textColumn as varchar(max)) as decimal(10,5))
 FROM someTable
more ▼

answered Apr 17, 2012 at 06:02 AM

avatar image

Magnus Ahlkvist
21.1k 19 39 42

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x2079

asked: Apr 17, 2012 at 05:24 AM

Seen: 1362 times

Last Updated: Apr 17, 2012 at 06:02 AM

Copyright 2016 Redgate Software. Privacy Policy