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)
 Converting a varchar type to decimal !!!

Author  Topic 

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2007-07-24 : 15:01:35
All,

I have a column that has numeric values, but has a datatype of varchar. How can I convert the datatype to decimal with precison 18 & scale 2.

Lets assume the table name is Table1
And the column is Column1 (varchar type)

How can I change it to decimal type (Precision 18, & Scale 2).

Looking for a quick response.

Thanks a million.

Zee

mattyblah
Starting Member

49 Posts

Posted - 2007-07-24 : 15:18:55
can you not use cast or convert? check BOL for the syntax.
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2007-07-25 : 06:38:46
alter table Table1
alter column Column decimal(18,2)

if you are trying to change the datatype of the table
select convert(decimal(18,2),col1) from table1 if you're just trying to manipulate data.

Jim
Go to Top of Page
   

- Advertisement -