| Author |
Topic |
|
detlion1643
Yak Posting Veteran
67 Posts |
Posted - 2010-04-19 : 16:23:21
|
| Originally I was going line by line through excel files (a vb.net program I worte) and was using if exists update/insert code. Since some excel files are 20,000+ rows it started taking way too long.This bulk insert is good so far, I got it working on the excel files, only problem is I can't seem to manipulate it to accept the if exists update part...Since it's not line by line anymore, is updating still possible? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
detlion1643
Yak Posting Veteran
67 Posts |
Posted - 2010-04-19 : 16:37:53
|
| Sample data:id,sku,price,stock,etc...1 , 1 , 350 , 20 , ...1 , 2 , 300 , 0 , ...Column2 is actually the pk, so I test for that. What I used to do was run an if exists select * from sku where sku= variableforsku update else insert.I got the variable from vb.net reading the excel file line for line. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
detlion1643
Yak Posting Veteran
67 Posts |
Posted - 2010-04-19 : 16:48:52
|
| SQL express 2008.I did a little more searching, and it looks like I might have to bulk insert into a 'work' table and then merge them, then delete the 'work' table.Will keep searching. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
detlion1643
Yak Posting Veteran
67 Posts |
Posted - 2010-04-19 : 16:59:53
|
| Thanks tkizer,Didn't think of truncate, good suggestion. Table/code are built - testing day tomorrow! |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|