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
 SQL Server Development (2000)
 how to convert this special varchar to int

Author  Topic 

donar
Starting Member

22 Posts

Posted - 2004-11-16 : 10:33:01
I have a table, the structure is like this:
ISN int,
maptype varchar(20),
map_subtype varchar(50),
scale varchar(15))

The scale field is actually an interger, i would like to change them to integer,the scale looks like this '15 084', '120', '100 000'

These four fields together will be primary key.
My question is how can I convert the scale from varchar to int?

Thanks a lot!

X002548
Not Just a Number

15586 Posts

Posted - 2004-11-16 : 11:03:02
Depending on the volume of data....I would create a new table...move the data either with an INSERT or bcp...drop the old and rename the new back to the old



Brett

8-)
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-11-16 : 21:17:28
update the data first removing space:

update tablename
set scale=replace(scale,' ','')

then change the data type to int using EM

--if the volume of data is not that large.

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -