SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: MS SQL Bulk Update
-
Jul 21, 2004, 11:56 #1
- Join Date
- Apr 2004
- Location
- Brazil
- Posts
- 22
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
MS SQL Bulk Update
Hi,
I've got a product table with about 16000 items. I now need to update about 300 of the quantities. The update information is in a simple Excel sheet consisting of 2 columns (product_name, qty).
Rather than doing 300 plus individual updates, how best would I perform a bulk update?
Thanks
-
Jul 21, 2004, 13:16 #2
- Join Date
- May 2003
- Location
- Washington, DC
- Posts
- 10,653
- Mentioned
- 4 Post(s)
- Tagged
- 0 Thread(s)
Easiest way--use Access. Import excel table, link to SQL table, do update query. At least if it is a one off type of thing.
Other method would be to setup a DTS package which is a bit more involved.
WWB
-
Jul 21, 2004, 16:26 #3
- Join Date
- May 2003
- Location
- San Diego
- Posts
- 786
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
BCP Utility would work too:
http://msdn.microsoft.com/library/de...p_bcp_61et.aspZak Ruvalcaba, MCAD, MCSD
SitePoint Author: Build Your Own ASP.NET Website using C#/VB.NET
Sams Author: Dreamweaver MX 2004 Unleashed
-
Jul 21, 2004, 17:19 #4
- Join Date
- Apr 2004
- Location
- Brazil
- Posts
- 22
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by wwb_99
Thanks for the response... I guess my question then is:
How do I build the Update query??
I've got no problem using the DTS functionality, I just don't see how I go about getting the destination table to update only those rows which are contained in the source...
Thanks
-
Jul 21, 2004, 18:57 #5
- Join Date
- Oct 2000
- Location
- Philadelphia, PA
- Posts
- 4,708
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Just import the excel spreadsheet into a temp table, and do an update off of an INNER JOIN on your products table.
Make sure you do a standard select statement first to make sure your query is perfect before you update your products table. The last thing you want to do is mess up 16000 records."Does this napkin smell like chloroform?"
...now with SnapFoo!
My Blog | My Twitter | My Company | SitePoint Podcast
*** Matt Mullenweg on the SitePoint Podcast ***
Bookmarks