a******8 发帖数: 46 | 1 (1) Apply following CLR Trigger when delete record from Table_1
For row to be deleted
Get associated tax from external file system.
(2) Delete_Stored_Procedure (non CLR)
DELETE from Table_1 where Year = 2008
问题是: CLR Trigger如何将Associated tax返回给Delete_Stored_Procedure?
谢谢! |
j*****n 发帖数: 1781 | 2 Is trigger necessary? you can get associated tax for records being deleted
first and then delete. |
a******8 发帖数: 46 | 3 Assume a couple of "delete" operation may appear:
- delete from Table_1 where Year = 2008
- delete from Table_1 where Year < 2008
- delete from Table_1 where Name = 'John'
Applying an trigger on delete is a simple & direct way. |
p********l 发帖数: 279 | 4 Try to put into another table? |
a******8 发帖数: 46 | 5 Yes. It should be ok to put result into another table then read it in stored
procedure. I'm wondering any other ways can help that. |
j*****n 发帖数: 1781 | 6 hehe, 2k5 new feature....
OUTPUT clause
delete from Table_1
OUTPUT DELETED.*
where Year = 2008 |
B*****g 发帖数: 34098 | 7 你这个不还是要一个temp table吗?
【在 j*****n 的大作中提到】 : hehe, 2k5 new feature.... : OUTPUT clause : delete from Table_1 : OUTPUT DELETED.* : where Year = 2008
|
j*****n 发帖数: 1781 | 8 his SP could catch this data set itself, why need temp table?
【在 B*****g 的大作中提到】 : 你这个不还是要一个temp table吗?
|
a******8 发帖数: 46 | 9 I need get "TAX" information from external file system. How can T-SQL SP get
it? I think we can re-write CLR SP, but it'll involve a lot of changes -
that's I'm trying to avoid. |
B*****g 发帖数: 34098 | 10 delete output can only get the deleted ids, then use this ids to get tax
from external source.
【在 j*****n 的大作中提到】 : his SP could catch this data set itself, why need temp table?
|
j*****n 发帖数: 1781 | 11 no idea about CLR SP... can you use xp_commandshell within your T-sql sp? it
might need higher privilege though.
get
【在 a******8 的大作中提到】 : I need get "TAX" information from external file system. How can T-SQL SP get : it? I think we can re-write CLR SP, but it'll involve a lot of changes - : that's I'm trying to avoid.
|
B*****g 发帖数: 34098 | 12 1. delete output
2. CLR user defined function (input id list)
get tax in function.
return id+tax list
it
【在 j*****n 的大作中提到】 : no idea about CLR SP... can you use xp_commandshell within your T-sql sp? it : might need higher privilege though. : : get
|
j*****n 发帖数: 1781 | 13 顶
【在 B*****g 的大作中提到】 : 1. delete output : 2. CLR user defined function (input id list) : get tax in function. : return id+tax list : : it
|
a******8 发帖数: 46 | |