Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Decimal

Author  Topic 

jung1975
Aged Yak Warrior

503 Posts

Posted - 2004-09-30 : 15:47:53
I have a column with char(7) and the data in the column looks like 0000100. I would like to update the data format to 00001.00 ( include 2 decimals)



Shurgenz
Yak Posting Veteran

51 Posts

Posted - 2004-09-30 : 16:11:25
select cast('00000100' as decimal(6,2))

sorry

select cast('00000100' as decimal(6,2))/100
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-10-01 : 07:24:11
this should help:

update MyTable
set Col1 = left(Col1, 5) + '.' + Right(col, 2)

note that your request will put your column length to Char(8).
so if you don't cjange that, you can't update it.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

VIG
Yak Posting Veteran

86 Posts

Posted - 2004-10-01 : 10:33:00
select replace(str('00000100'/100,8,2),' ','0')
Go to Top of Page
   

- Advertisement -