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

sql md5加密函数怎么应用啊?
我在sql   的查询分析器里面运行了下面网址的语句

http://dev-club.esnai.com/club/bbs/showEssence.asp?id=23513&page=1

现在我要在表的触发器里面应用md5,   该怎么写?

原来是用sql   自带的加密的
CREATE   trigger   AccountInfo_update  
on   AccountInfo  
for   update  
as  
if   update(密码)  
begin  


Update   br  

            Set   br.password=convert(varbinary(64),pwdencrypt(i.密码))
            From   AccountInfo   br   ,   Deleted   d   ,Inserted   i  
            Where   br.Login=d.Login

     
end  




------解决方案--------------------
CREATE trigger AccountInfo_update
on AccountInfo
for update
as
if update(密码)
begin
Update br
Set br.password=dbo.md5(br.密码)
From AccountInfo br , Deleted d ,Inserted i
Where br.Login=d.Login
end
------解决方案--------------------
SQL Server没有dbo.md5()这个函数。

需要自己处理。
------解决方案--------------------
首先用VC开发一个MD5的 ActiveX 控件,注册;
然后在SQL 中编写一个专用的用户SP,调用;
在你应用的地方调用这个SP好了!