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 > Any code for automatically inserting queries of first table into the second?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-03-04, 18:10
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
Any code for automatically inserting queries of first table into the second?

Any code for automatically inserting queries of first table into the second?
Is there a way of inserting the query of records from the first table into the second? Because I want to use the second db by deleting records that might be unnecessary.

I want to copy the searches of one table to another. Let's say I search a keyword I want the search to go through the first table and copy the records where the keyword is to be found to the second table. I find that would be easy to study. Whatever I don't want from that search I can easily delete it. And at the same time I have the original table not tampered.
Reply With Quote
  #2 (permalink)  
Old 09-03-04, 18:54
bosewicht1 bosewicht1 is offline
Registered User
 
Join Date: Sep 2004
Posts: 16
could u just

INSERT INTO Table2 (field1)
SELECT * FROM Table1;

i believe u can just use the INSERT cmd
Reply With Quote
  #3 (permalink)  
Old 09-03-04, 19:46
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
ok...

Is it before or after (I'd guess it's before) the
HTML Code:
<%rs.Open SQL%>
statement?
Reply With Quote
  #4 (permalink)  
Old 09-17-04, 19:07
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
execute problem

What does this mean?

Quote:
INSERT INTO results(id, book, book_spoke, recordType, book_title, chap, chapter, chapter_spoke, vers, verse, verse_spoke, text_data) VALUES (, , , '', '', , , , , , , '')
Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'execute'

/kjvresp.asp, line 280
Reply With Quote
  #5 (permalink)  
Old 09-17-04, 21:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
the problem is here: VALUES (, , , '', '', , , , , , , '')

you have to put something for each column

at worst, you could use nulls (assuming the table allows nulls)

VALUES (null, null, null, '', '', null, null, null, null, null, null, '')
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 09-17-04, 21:34
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
That was because...

I had put && around each fieldname. But I made some changes. But this is what I got now:

Quote:
INSERT INTO results SELECT * FROM bible WHERE text_data LIKE '%ezra%' AND text_data LIKE '%%' AND text_data LIKE '%%'
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.

/kjvresp.asp, line 272
The insertion was found in the table but the output to the ASP page is somehow blocked.
Reply With Quote
  #7 (permalink)  
Old 09-17-04, 21:47
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
text_data LIKE '%%' is true for every row and should be dropped

if you have an ASP problem, you should post in the ASP forum

this forum is for generic (non-proprietary) SQL
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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