Click here to Skip to main content
15,903,175 members
Home / Discussions / Database
   

Database

 
GeneralRe: stored procedure problem Pin
Rein Hillmann18-Apr-03 13:25
Rein Hillmann18-Apr-03 13:25 
GeneralRe: stored procedure problem Pin
AlphaS18-Apr-03 21:03
AlphaS18-Apr-03 21:03 
GeneralMSDE server performance question Pin
Member 9617-Apr-03 7:27
Member 9617-Apr-03 7:27 
GeneralRe: MSDE server performance question Pin
Mark Smithson17-Apr-03 8:22
Mark Smithson17-Apr-03 8:22 
GeneralRe: MSDE server performance question Pin
Member 9617-Apr-03 8:51
Member 9617-Apr-03 8:51 
GeneralRe: MSDE server performance question Pin
andyharman18-Apr-03 4:07
professionalandyharman18-Apr-03 4:07 
GeneralRe: MSDE server performance question Pin
Member 9619-Apr-03 18:08
Member 9619-Apr-03 18:08 
QuestionSQL Server Insert and trigger question? Pin
Bart-Man17-Apr-03 4:57
Bart-Man17-Apr-03 4:57 
Greetings,

I have never used triggers in SQL, and I think they could help me with a project I am working on.
So here is my question:

1.)I have 2 testing tables setup with the folowing information to just get an understanding...
(ie) MyTableA, MyTableB

MyTableA Fields
---------------
Id (Auto-number primary key).
ItemTrackNumA (used for tracking the item in table2)
TestValue (used for storing a value).

MyTableB Fields
===============
Id (Auto-number primary key)
ItemTrackNumB (used for tracking items)
LastValue (used for storing last value used)

2.) No every time I insert a value into MyTableA I want it to either add a new record in MyTableB (if
ItemTrackB is not found in the table MyTableB),or adjust the LastValue in MyTableB if ItemTrackB is
the same as ItemTrackA.

(ie) INSERT INTO MyTableA(ItemTrackNumA, TestValue)
VALUES (3, 100)

Would then perform a lookup in MyTableB and if the ItemTrackB was equal(or found) to ItemTrackA
it would just replace LastValue in MyTableB with the TestValue from MyTableA.

In this case LastValue would not have the 100 in it.

And if the ItemTrackB wasn't found than a new record would just be inserted.


I am thinking triggers would work great for this but I have so little experiance with SQL triggers that
any suggestions would be appreciated. Smile | :)

Thanks in advance!!


AnswerRe: SQL Server Insert and trigger question? Pin
Chris Meech17-Apr-03 7:47
Chris Meech17-Apr-03 7:47 
GeneralRe: SQL Server Insert and trigger question? Pin
Bart-Man17-Apr-03 9:48
Bart-Man17-Apr-03 9:48 
GeneralRe: SQL Server Insert and trigger question? Pin
Chris Meech17-Apr-03 10:06
Chris Meech17-Apr-03 10:06 
GeneralRe: SQL Server Insert and trigger question? Pin
Bart-Man17-Apr-03 10:43
Bart-Man17-Apr-03 10:43 
GeneralSQL problem Pin
John-theKing16-Apr-03 21:53
John-theKing16-Apr-03 21:53 
GeneralRe: SQL problem Pin
Richard Deeming16-Apr-03 23:22
mveRichard Deeming16-Apr-03 23:22 
QuestionHow to rename a table in a database? Pin
Paul Selormey16-Apr-03 20:02
Paul Selormey16-Apr-03 20:02 
AnswerRe: How to rename a table in a database? Pin
DiWa16-Apr-03 21:28
DiWa16-Apr-03 21:28 
GeneralRe: How to rename a table in a database? Pin
Paul Selormey17-Apr-03 0:51
Paul Selormey17-Apr-03 0:51 
GeneralRe: How to rename a table in a database? Pin
Paul Selormey17-Apr-03 1:50
Paul Selormey17-Apr-03 1:50 
GeneralRe: How to rename a table in a database? Pin
DiWa17-Apr-03 2:44
DiWa17-Apr-03 2:44 
GeneralRe: How to rename a table in a database? Pin
Paul Selormey17-Apr-03 3:18
Paul Selormey17-Apr-03 3:18 
AnswerRe: How to rename a table in a database? Pin
Bruce Duncan17-Apr-03 1:14
Bruce Duncan17-Apr-03 1:14 
GeneralRe: How to rename a table in a database? Pin
Paul Selormey17-Apr-03 1:20
Paul Selormey17-Apr-03 1:20 
GeneralSQL Server AND Access Pin
theJazzyBrain16-Apr-03 13:13
theJazzyBrain16-Apr-03 13:13 
GeneralRe: SQL Server AND Access Pin
Paul Selormey17-Apr-03 0:55
Paul Selormey17-Apr-03 0:55 
GeneralRe: SQL Server AND Access Pin
theJazzyBrain17-Apr-03 1:53
theJazzyBrain17-Apr-03 1:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.