If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > populate numeric col with data from varchar

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-31-02, 16:35
lilith lilith is offline
Registered User
 
Join Date: May 2002
Posts: 2
populate numeric col with data from varchar

I need to populate (UPDATE) a field called 'analy' with the numeric data from a varchar field called 'result'. The problem is there are alpha characters in some of the values. I need to weed those out and set only the numeric values into 'analy'. I keep getting the 'Error converting data type varchar to numeric.' error in query analyzer. I've tried a bunch of different things and have tried to minimize it to just an update statement setting analy=result where isnumeric(result) =1. Can anyone help me out?

I'm using sql server 2000 if it matters.
Thanks in advance!
L
Reply With Quote
  #2 (permalink)  
Old 05-31-02, 22:40
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Is result part of the same table as analy ? What is the key field for this table ? Do you want to update analy with the field result from the same row ?
Reply With Quote
  #3 (permalink)  
Old 06-03-02, 13:22
lilith lilith is offline
Registered User
 
Join Date: May 2002
Posts: 2
rnealejr,
Thanks for your reply.
1. 'result' is in the same table as 'analy'.

2. pKey is the primary key generated on creation/update of table (this table is created from a dtc pulling data from a view that lives on another server and administered by someone that sits very far away from me...don't know how they have databases without keys, but they do so I added my own).

3.I do want to update analy with the field result from the same row.
Thanks again.
WJ
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On