Avatar of dizzycat
dizzycat
 asked on

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

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)
C#Microsoft SQL Server 2008SQL

Avatar of undefined
Last Comment
BlueYonder

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
AndyAinscow

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
BlueYonder

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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck