Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Would you please let me know what I did wrong?

Status
Not open for further replies.

123rose

Vendor
Aug 13, 2002
7
US
Hi Gary,

Thank you very much for the quick response. Would you please have a look at the attached file and let me know why it still did not work after inserting the code you give me. In the SQL, I just want to select and delete the record, how can compile the where clause?

I very appreciate it.

Thanks again and have a great day,

:)Rose

How can I send you the attachment?
 
Hi Gary,

Thank you very much for the code you gave me. It worked perfect. I have just one more question, must I have a primary key field to do that? What should I do if I do not have a primary key in the table.

Thank you very much and have a great day.

Rose
 
Here is the code to insert data from one table into another table with identical structures.

INSERT INTO tblNew
SELECT tblOld.* FROM tblOld WHERE some criteria.

You don't have to have a primary key for this to work. You just need some criteria which will correctly identify the records you want to transfer. Of course it will work faster if the search fields are indexed.

Have a great day!

 
Be careful. If you have no primary key you could load the same data many times. And, how would you know whether it was already in the table? Just issues to ponder.

----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
SCKing,

Your point is well taken, however I wasn't suggesting that as a course of action. My answer was predicated on the assumption (I know, I know) that you would be able to use where clause criteria sufficient to restrict the number of records to what you really wanted.

As an ugly example,

"Where lastname = 'Smith' And firstname = 'Joe' And city = 'Chicago' and state = 'Illinois' and etc"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top