February 15, 2013 at 10:43 am
Hello,
I need to convert an integer into decimal by specifying the decimal point.
For example, if i have 0000318750, when i try to convert into decimal it gives me 318750.00, but i need it to be 3.18750.
Can this be done? Thanks in adavance.
CREATE TABLE #X (Samp decimal(15,5));
INSERT INTO #X VALUES ('0000318750')
SELECT * FROM #X
February 15, 2013 at 10:58 am
Like this?
update #X set Samp = Samp / 100000
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
February 15, 2013 at 10:59 am
Yes, I just did it.
Thank you.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply