question

aboyosof avatar image
aboyosof asked

Update field or fields value in one table from another table

I have created a database with two tables so far. One table named MenuItems and the other named PriceImport. Bothe items have the same fields PLU(primary Key in both), Description, Size, Cost, Price. What I am trying to do as a beginner in SQL is to learn how to make the prices I export into the Table: PriceImport update the Price in the MenuItem the minute they are exported in the presence of the primary key. I don't know how to do this but I know many members here are SQL masters and will appreciate learning from you all. I am trying to learn sql one step at a time but my eventual goal is to attempt to make a form that would run in Windows Mobile 5.0 or Pocket PC environment that I can use to collect data and sent directly to my sql database BUT for now I taking multiple routes to get to my database starting with an excel table in my handheld device and exporting it to MS access 2007 then linking a table there to sql table named PriceImport and got stuck there. Help is appreciated
update
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

James_Chandler avatar image James_Chandler commented ·
Is MenuItems a table in MS Access 2007? And is PriceImport is a table in a SQL Server database?
0 Likes 0 ·
aboyosof avatar image aboyosof commented ·
both in SQL Server database
0 Likes 0 ·

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered
It sounds like you want to have a trigger. [Here's the Books Online entry for that][1]. You want a Data Manipulation Language (DML) trigger. [1]: http://msdn.microsoft.com/en-us/library/ms189799.aspx
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

aboyosof avatar image aboyosof commented ·
how do you write the trigger
0 Likes 0 ·
Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
Read the documentation. It shows several examples.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.