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)
 Data Conversion

Author  Topic 

vicvegas777
Starting Member

3 Posts

Posted - 2005-02-09 : 09:02:01
I just imported an excel table into SQL and I need to join if with an existing table. The two fields I want to join are both a group of vendor IDs. The data type in my existing table is an nvarchar. In my newly imported table, the same field is a float. I would like to permanently convert the float field to an nvarchar. When I use the convert function in my select statement [ convert(nvarchar, vendor) ] it is converted into scientific notation, which I definitely do not want. I am wanting to update the vendor IDs in my existing table with those in my new table, which I can do, but I want to do a preliminary join of the two first, which I am unable to do because the data types are not the same. Can you help??

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-09 : 09:12:28
in EM go to design table and change the column to nvarchar.
that should do it..

do a backup of the table first (insert the data into a temp table so you don't loose it if something goes wrong)

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

vicvegas777
Starting Member

3 Posts

Posted - 2005-02-09 : 09:52:28
After I did that, it did convert them.

However, when I opened the table back up, most of my values are now in scientific notation. How can I change that?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-09 : 10:27:08
can you give us some sample data?

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

vicvegas777
Starting Member

3 Posts

Posted - 2005-02-09 : 11:12:49
I kept playing with it and got it to work.

I converted it from float to an integer first, then to an nvarchar, it converted it without the scientific notation.

Thanks for your help!
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-09 : 11:13:33
now those are some converts

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

deronrb
Starting Member

6 Posts

Posted - 2005-10-24 : 11:17:52
I'm encountering the same error. I tried your fix of converting to int first, but it won't let me. it's giving me a mathematical overflow error! Any advice?
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2005-10-24 : 12:07:00
are the numbers too large for integer??
what is your maximum/typical value?
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2005-10-24 : 12:08:19
and for the others this question seems to be related to
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=56829
Go to Top of Page

deronrb
Starting Member

6 Posts

Posted - 2005-10-24 : 12:20:20
Ah, figured it out... had to do float to BIGint to nvarchar. :) Thanks!
Go to Top of Page
   

- Advertisement -