Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

815 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

14 Experts available now in Live!

Get 1:1 Help Now