Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bpuccha
Starting Member
34 Posts |
Posted - 2012-06-08 : 10:05:16
|
Hi,I have to bulk update my table "a" using a flat file Flatfile.txtTable a:ID name add1 add2 phone_no 1 aaaa test1 test2 1234567892 bbbb test3 test4 5768789793 cccc test5 test6 6837897904 dddd test7 test8 687978980Flatfile.txtid name phone_no3 XXXXX 65485849784 zzzzz 954759084here I have to update the rows with id 3 and 4 with changed name and phone no in the table a..So output should be like thisTable a:ID name add1 add2 phone_no 1 aaaa test1 test2 1234567892 bbbb test3 test4 5768789793 XXXXX test5 test6 65485849784 zzzzz test7 test8 954759084One way is to insert the data from a flat file to a table and update the table a by joining the tables.Is there any other way? |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-06-08 : 11:44:37
|
You could join in an ssis package to do the updates before the inserrt - or output the result to a file if that is the destination.Importing to a table allows you to see what is going on though.Oh v2000 - not sure if DTS can cope with that - probably not a good idea even if it can.I would bulk insert, update, bcp out if necessary. It's by far the simplest method and would be might default on any version - would need a reason to use anything else.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
bpuccha
Starting Member
34 Posts |
Posted - 2012-06-08 : 12:05:32
|
What is OPENROWSET? What does it do? |
|
|
bpuccha
Starting Member
34 Posts |
Posted - 2012-06-08 : 12:31:15
|
Actually me scenario is...I have a Java code where i am updating the table, If the updation fails I will keep that row in a text file, at last I have to bulk update the table for the failed rows once. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|