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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-10-24 : 09:41:53
|
| Franklin writes "Hi!, i need to know how can i do this in SQL:I need a trigger that audits some tables on my system so, I wrote it and I proved; it works well when I update, delete one column, but if I do something like "update table_1 set c1 = 'e'" it gives me an error, because I took the old data from the virtual tables, it gives me more than one row into a single variable; I've tried to find out how to make the trigger to be fired per row, not per statement just as I do it in Oracle, but it seems that SQL Server can´t do that, I've thinking using cursors or temporal tables, but I fear to affect the performance.My question is: How can i get one by one the values from the virtual tables without using cursors nor temporal tables?I'm using SQL Server 2000 and Windows 2000Thank you for your answerFranklin" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-24 : 10:03:56
|
| >>My question is: How can i get one by one the values from the virtual tables without using cursors nor temporal tables?Select top 1 column from yourTableGive more information by giving the code you used, sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-10-24 : 11:24:09
|
I think your question should be, "How can I write my update statment to use the inserted and deleted tables directly instead of assigning individual values to variabls?" >>I've thinking using cursors or temporal tables, but I fear to affect the performance.Your fears are well founded.As madhivanan says, Post the code you've got and we'll be able to offer alternatives.Be One with the OptimizerTG |
 |
|
|
|
|
|
|
|