Solved

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

Posted on 2013-12-05
2
348 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Icons and Colors for Terms 3 24
What is Thread.Sleep? 5 44
tempdb latch contention 12 47
Error in JQuery 5 34
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

947 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

21 Experts available now in Live!

Get 1:1 Help Now