top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

remove decimal points from a column value.

+4 votes
282 views
remove decimal points from a column value.
posted Nov 14, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+3 votes
 
Best answer

CREATE TABLE TableDecimal (Value DECIMAL(24,21))
INSERT TableDecimal (Value) VALUES (2)
INSERT TableDecimal (Value) VALUES (3.00000000000000000000)
SELECT Value FROM TableDecimal
SELECT CAST(Value AS INT) AS Value_to_int FROM TableDecimal
SELECT CAST(Value AS DECIMAL(24,0)) AS Value_to_Decimal0 FROM TableDecimal
GO
DROP TABLE TableDecimal
GO

answer Nov 14, 2014 by Manikandan J
Similar Questions
+4 votes

I have a requirement in which a column in the table should have distinct values but it may have multiple null values. How can I achieve that?

+3 votes

I have a table that looks something like this:

SetId ID Premium 
2012 5 Y 
2012 6 Y 
2013 5 N 
2013 6 N

I want to update the 2013 records with the premium values where the setid equals 2012.
So after the query it would look like this:

SetId ID Premium 
2012 5 Y
 2012 6 Y 
2013 5 Y 
2013 6 Y

Any help greatly appreciated

...