Omega Owners Forum
Chat Area => General Discussion Area => Topic started by: tunnie on 06 November 2008, 11:04:55
-
Does anyone know how to format a colum with SQL to remove a decimal point and reformat it to a numerical column rather than character?
-
Does anyone else understand the question? :-/ ;) ;) ;)
-
Yep. Just looking through me scripts
-
What data type is the column now?
-
If it's already a text column, use
update dbo.table
set column2 = replace(column2,'.','')
replaces the . with nothing, then change the datatype in manager to a numeric one? Just tried it on a test table seemed to work ok
-
if for display,print purpose
select convert(decimal(25,0),field) from table
or
select cast(field as decimal) from table
this will cut the fraction part and still keep the numeric representation
or if you want to modify the column you must use
alter table TABLE alter column COLUMN decimal(25,0) NOT NULL etc