> -----Original Message----- > From: Crow T. Robot [mailto:[EMAIL PROTECTED] > Let's say that I have a CSV file that I am reading into a page, and I > convert it to a query. I have a database table that it set > up exactly > like the converted query, I want to basically insert the CSV > data into > the database. Is there an easier, more efficient way to do this that > looping over the CSV query and doing an insert for each record? > > SQL Server 2K, CFMX6.1
As people have mentioned, you can use BCP to copy data into the database, but you can also use the BULK INSERT command in T-SQL as well. If you check books online you'll see what's possible with both options. Since your date field must be unique, you can put a unique constraint on that column in the database (if not done already) and then any rows that violate that constraint will not be imported (check the switches and commands for BCP and bulk insert). This way you don't need to perform extra checks (based on what you've told us). So, there are a handful of ways to do it: SQL executed from CF (inline, stored procedure), scheduled or executed DTS packages (via command line dtsrun.exe program as Dave pointed out), the BCP utility, and probably a few more I can't think of right now. Andy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:244594 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

