Solved

Update data over 2 tables (no inner or outer joins)

Posted on 2013-12-05
2
345 Views
Last Modified: 2013-12-05
Hi Experts

Im using a dataset in C# and I have an update query which passes parameters to the fields of one table, this works fine but how would i alter this query to update data over two tables, the dataset does not allow for the use of joins.




UPDATE       SalesPriceLevels
SET                UnitOfSale = @UnitOfSale, Quantity = @Quantity, ExPrice = @ExPrice, IncPrice = @IncPrice, Margin = @Margin, Profit = @Profit, VATRate = @VATRate, VATDescription = @VATDescription
WHERE        (ProductID = @ProductID)
0
Comment
Question by:dizzycat
2 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 39697984
Use two separate update queries.
0
 
LVL 9

Expert Comment

by:BlueYonder
ID: 39698002
You would need to use 2 separate update t-sql queries to update 2 separate tables.  Secondary option is to add triggers to the database to automatically update values from one table into another.  Here is an example, http://www.kodyaz.com/articles/sql-trigger-example-in-sql-server-2008.aspx.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now