用于加密的存储过程 (sp_EncryptObject) :
存储过程(sp_EncryptObject)加密的方法是在存储过程,函数,视图的“As”位置前加上“with encryption”;如果是触发器,就在“for”位置前加“with encryption”。
如果触发器是{ AFTER | INSTEAD OF} 需要修改下面代码"For"位置:
if objectproperty(object_id(@Object),'ExecIsAfterTrigger')=0 set @Replace='As' ; else set @Replace='For ';
存储过程完成代码:
ALTER PROCEDURE [dbo].[TransProcEmployee]
(@员工编号 [VarChar](50),
@员工姓名 [VarChar](50))
With Encryption AS
BEGIN
INSERT INTO [db_Tome2].[dbo].[员工信息表] ([员工编号],[员工姓名]) VALUES (@员工编号,@员工姓名)
END
如果SQL Server 2012,请修改下面两个位置的代码。在SQL Server 2012,建议在使用throw来代替raiserror。