Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ann
Posting Yak Master
220 Posts |
Posted - 2006-07-07 : 19:14:23
|
| Hi- I am writing my first tran and am having an issue with my where clause:CREATE PROCEDURE UpdateSatisfied@NoteID int,@CreateDate datetime,@NoteAuthor VARCHAR(20),@CaseNote CHAR(12),@fraudCaseID intASBEGIN TRAN UPDATE SatisfyNotes SET NoteAuthor = @NoteAuthor ,CreateDate = @CreateDate ,CaseNote = @CaseNote IF (@@ERROR <> 0) GOTO ERR_HANDLER INSERT INTO CaseNotes(NoteStatus) VALUES ('Satisfied') WHERE CaseNotes.NoteID = @NoteID IF (@@ERROR <> 0) GOTO ERR_HANDLER COMMIT TRANRETURN 0ERR_HANDLER:ROLLBACK TRANRETURN 1can someone help? Thanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-07-07 : 19:26:42
|
| The first UPDATE statement is missing a WHERE clause. If a WHERE is not present, you are updating all rows in the table, not just one row.The first INSERT statement should be a UPDATE statement too.Peter LarssonHelsingborg, Sweden |
 |
|
|
ann
Posting Yak Master
220 Posts |
Posted - 2006-07-07 : 21:10:00
|
| oops! thanks! |
 |
|
|
|
|
|