question

a_p5058 avatar image
a_p5058 asked

How to remove decimal from a field in sql

I am new in sql and am trying to remove decimal from a field that looks like this V34.5s S26.30 00.13 M46.66 Am not sure how to do this, please help. This is what I want the field to look like V345s S2630 0013 M4666 Please help
decimal
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
JohnM avatar image
JohnM answered
You can use REPLACE to do this. Reference: https://msdn.microsoft.com/en-us/library/ms186862.aspx DECLARE @field VARCHAR(100) = 'V34.5s S26.30 00.13 M46.66' SELECT REPLACE(@field, '.','') GO Hope that helps!
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

a_p5058 avatar image a_p5058 commented ·
this what my field looks like codes W61.39XS W61.4 W61.42 W61.42XA W61.42XD W61.42XS W61.43 W61.43XA W61.43XD W61.43XS W61.49 codes W61.39XS W61.4 W61.42 W61.42XA W61.42XD W61.42XS W61.43 W61.43XA W61.43XD W61.43XS W61.49 W61.49XA W61.49XD W61.49XS W61.5 W61.51 W61.51XA
0 Likes 0 ·
Magnus Ahlkvist avatar image Magnus Ahlkvist a_p5058 commented ·
Because of the formatting in your original post, it was hard to see how each individual row looked, but regardless of that, using the REPLACE-function on the column, replacing '.' with '' like @JohnM suggests would do the trick.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.