i want to Improve performance by using single update statement. already i hit multiple times for update data in table i want to avoid this. i want to use like BCP Command.
Note - Using VB.net 2.0 Code
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 21, 2014, 3:16 AM EDT
Please provide more information like which type of data you want update in bulk...
also provide some test data.
In this case you can do one thing delete existing data and insert new data
Abhijeet ChavanRank #9,090 · 211 reputationPosted Jul 21, 2014, 3:49 AM EDT
i want to update cus_name and addr on basis of cust_no and cust_id in only one database operation. must update 3 records at a time. .. no i don't want delete existing data
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 21, 2014, 3:58 AM EDT
Hi,
Create stored procedure that accept either table value parameter or xml as input.
here table value parameter or xml is nothing but data that you want to update in to database that contain primary key data...
write update statement with Select Query like
UPDATE
Customer
SET
Customer.cust_no = p.cust_no,
Customer.cust_name = p.cust_name
FROM
Customer
INNER JOIN
@Customer_input p
ON
Customer.id = p.id
Refer
http://www.c-sharpcorner.com/UploadFile/ff2f08/table-value-parameter-use-with-C-Sharp/
hope this will help you.
Abhijeet ChavanRank #9,090 · 211 reputationPosted Jul 21, 2014, 4:18 AM EDT
Ramesh MaruthiRank #937 · 2.2K reputationPosted Jul 21, 2014, 7:15 AM EDT
databaseName.Schema.TableName *or* "Query"
in, out, *or* queryout
-S ServerName\instanceName
-U userName -P password *or* -T
-c *or* -n *or* specify storage information for each column
bcp "UPDATE
Customer
SET
Customer.cust_no = p.cust_no,
Customer.cust_name = p.cust_name
FROM
Customer
INNER JOIN
@Customer_input p
ON
Customer.id = p.id" queryout
C:\bcp_outputQuery.txt -SYourServerName -T -c