Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Help with inserting values from information not found in another table

Reply
Thread Tools

Help with inserting values from information not found in another table

 
 
Joey Martin
Guest
Posts: n/a
 
      07-16-2003
I have a tmp_phone that I am comparing to table_phonelistings using the
phone field.

I then want to insert the values (ac,phone) from the tmp_phone table NOT
IN table_phonelistings, into the table_phonelistings.

I think I am doing an incorrect loop as it's timing out. Any help is
appreciated. Here is what I have:

sql2="select ac,phone from tmp_phone where phone not in (select phone
from table_phonelistings)"
set rs=conn.execute(sql2)
sql3="insert into table_phonelistings (areacode,phone) values ('" &
rs("ac") & "','" & rs("phone") & "')"
conn.execute(sql3)
do while not rs.eof
loop
conn.close



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      07-16-2003
Only one SQL command is needed:

sql = "Insert into table_phonelistings (areacode,phone) " & _
"Select ac,phone from tmp_phone where phone not in " & _
"(select phone from table_phonelistings)"

conn.execute sql,,1 '1=adCmdText

see below for an explanation of your time out:

Joey Martin wrote:
> do while not rs.eof


You don't have any code inside this loop! of course it's timing out. Well,
you don't need the loop anyways.

> loop


HTH,
Bob Barrows


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamically inserting table rows in IE generates "interface not supported" lsiden@gmail.com Javascript 0 11-19-2004 07:30 PM
Inserting Records from another table Bijoy Naick ASP .Net 1 06-30-2004 07:06 PM
Inserting values into a table Fawke101 ASP General 5 04-02-2004 08:13 PM
Could not load type VTFixup Table from assembly Invalid token in v-table fix-up table. David Williams ASP .Net 2 08-12-2003 07:55 AM
Another Dumbass Question: Table not found Child ASP .Net 3 08-08-2003 10:41 AM



Advertisments