T-SQL Algorithm to Encode Unsafe HTML Characters as HTML Character Entity References

前端 未结 3 2136
情深已故
情深已故 2021-01-03 12:40

I need to create an after insert trigger in my SQL Server 2008 R2 database.

The trigger needs to take some fields from INSERTED, process them and pu

3条回答
  •  甜味超标
    2021-01-03 12:57

    How about creating a SQL UDF in .NET that calls Server.HtmlEncode(myUnsafeHtml) and loading that into the SQL server? To get started:

    http://blog.sqlauthority.com/2008/10/19/sql-server-introduction-to-clr-simple-example-of-clr-stored-procedure/

    http://www.codeproject.com/Articles/37377/SQL-Server-CLR-Functions

    http://msdn.microsoft.com/en-us/library/ms254498(v=vs.80).aspx

提交回复
热议问题