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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql batch insert

Status
Not open for further replies.

BlackDice

Programmer
Mar 1, 2004
257
US
I think I should've put this question in this forum first, but instead i put it in a foxpro forum. Please don't think I'm trying to double-post. here's my post:

I'm trying to do an insert statement like a batch insert from C++ using an ODBC function. Regular Insert statements work, but I want to send a string that will execute all of these statments like a script, like this:

INSERT INTO tblPeople (Firstname, Lastname) VALUES ('John','Doe');
INSERT INTO tblPeople (Firstname, Lastname) VALUES ('Jane','Doe');
INSERT INTO tblPeople (Firstname, Lastname) VALUES ('Mary','Doe');

It doesn't seem to work. I'd like to know if anyone here has any tips or knowledge on how to do this. Thanks!!

bdiamond
 
SQL INSERT table (column list)... VALUES(value list) inserts one row.

As to how you might insert multiple rows from an application depends on the application. If your application is a FoxPro application then that is the right place to post your question.
 
I'm using the odbc api from C++. Inserting one row works fine already, but I'll try the syntax you outlined above also and let you know how it works. Thanks!!

bdiamond
 
I may be responding to an old post ... I think you have to loop your insert statement ... you may have to use soem storage (probably double dim arrays) and then insert ... I guess you may have one more question. Where to commit? That depends on the size of the data/system.
 
I ended up getting it working with another method (a class made by someone one codeproject.com that writes directly to a .dbf which turned out to be about a hundred times faster). Thanks though, I appreciate you trying to help

bdiamond
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top