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 |
|
mr_blore
Starting Member
7 Posts |
Posted - 2004-10-18 : 08:19:53
|
| I have 2 questions1. How do i effectively handle errors in my Stored proc? @@ERROR does not work for errors like "Syntax error converting the varchar value to a column of data type int" etc. Is it effective to have Transactions inside the StoredProc or have transactions in the client?2. I have an INSERT which inserts multiple rows at a time.ex. INSERT INTO table1 (col1, col2) SELECT col1, col2 FROM table2If any one of insert row fails, I want to skip it and continue with the others. Is it possible?Thanks :) |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-10-18 : 09:51:25
|
| You can always get errors that will abort the batch and these are not trappable.You should check @@error after every statement.Put transaction control in the SP unless you can't avoid it.Every sql statement is atomic i.e. it will succeed or fail.Saying that there are a few things you can do like ignore dup keys.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|