Forum Moderators: coopster
I'm trying to find the most efficient method to use in order to insert 5 to 10 thousand records. Basically, I have a script that creates pins; the user just selects the number of pins to create.
I have to believe that something better than this exists:
#open DB
#while loop to perform a crazy amount of mssql inserts
#close DB
Anybody have any ideas or creative solutions? =)
Currently, I'm doing research to find out if I can dynamically create an excel file (containing all the pins) and push that data into the mssql DB via php. I don't think it's possible though...=(
Thank you in advance!
M.Cold
I don't think that I have access on the DB server to create stored procedures, but if I do that will be the route I'll be taking. Even though, at the end of the day, the same while-loop methodology will be applied...I think. =/
Oh, and the data being stored (in a single table) are the combination of consecutive numbers, random numbers, and constants.
Thanks,
M. Cold
A bit of a google... does your version of MSSQL support this sort of thing? (Is there a 'bcp' - bulk copy program?)
BULK INSERT tblMyTable FROM 'c:\mydata.txt' WITH (FIELDTERMINATOR = ',')
May be the database forum [webmasterworld.com] can offer more help...?
I think your right on the money. I was thinking DTS package or bulk insert (from excel to db), but a CSV would be much better.
*hits himself on the head*
Plus, I'm not even sure you can work with DTS packages from PHP. I know you can using ASP/.Net platform. At any rate, thank you again. I'm gonna go perform the test now! =)
M. Cold