Reformatting SQL Data in a Field

45 pts.
Tags:
SQL
SQL 2005
Hi, I'm new to the whole SQL experience and need help converting some data.  In our Activity table, data was imported into the UF_4 field incorrectly.  We want to convert this data "from a Decimal format" to a “NonDecimal”.  Currently the data looks like 5234.000 and we want it to look like 5234 Thanks in advance for any help. DJ



Software/Hardware used:
SQL 2005

Answer Wiki

Thanks. We'll let you know when a new response is added.

I’m assuming that the data type of the UF_4 field is varchar or similar.

You will probably need something like this:

<pre>UPDATE Activity SET uf_4 = cast(cast(uf_4 AS DECIMAL) AS INT);</pre>

——————————

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • DCDJ
    The Condensed Data Type is: Numeric(15,4) Data Type: Numeric Precision: 15 Scale : 4
    45 pointsBadges:
    report
  • carlosdl
    The data is stored that way because of the data type of the column. Do you want to change the data type ? If so, it would be something like this:
    ALTER TABLE Activity
    ALTER COLUMN uf_4 NUMERIC(15,0)
    If that's not what you need, could you please provide more details about your requirement ? Thanks,
    69,175 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following