日期:2014-05-18  浏览次数:20488 次

如何对触发器进行加密?
比如加密存储过程时,用 WITH ENCRYPTION 

但是以下的触发器:
ALTER trigger [dbo].[tri_t_wh_billofdocument] on [dbo].[t_wh_billofdocument]
for update

as begin
 if update(materamount) 
  begin
  if exists(select 1 from inserted where sign in (23,24) and (auditing is not null))
  begin
  rollback
  end
  end
end  

我要进行加密,如何写代码?我用的sql2005数据库

如果这样写:
ALTER trigger [dbo].[tri_t_wh_billofdocument] on [dbo].[t_wh_billofdocument]
for update
  WITH ENCRYPTION
as begin
 if update(materamount) 
  begin
  if exists(select 1 from inserted where sign in (23,24) and (auditing is not null))
  begin
  rollback
  end
  end
end  

会报错的:

消息 195,级别 15,状态 1,过程 tri_t_wh_billofdocument,第 9 行
'ENCRYPTION' 不是可以识别的 选项。


------解决方案--------------------
一样的

CREATE TRIGGER trigger_name ON { table | view } [ WITH ENCRYPTION ]