代码如下:
源代码:
CREATE FUNCTION [dbo].[svf_StringToBase64] ( @input NVARCHAR(MAX) ) RETURNS NVARCHAR(MAX) AS BEGIN RETURN (SELECT CAST(@input AS VARBINARY(MAX)) FOR XML PATH('')) END GO CREATE FUNCTION [dbo].[svf_Base64ToString] ( @input NVARCHAR(MAX) ) RETURNS NVARCHAR(MAX) AS BEGIN RETURN (SELECT CAST(CAST(@input AS XML).value('.','VARBINARY(MAX)') AS NVARCHAR(MAX))) END GO
Source Code
实例:
源代码:
SELECT [dbo].[svf_StringToBase64] (N'insus.net@中国') GO SELECT [dbo].[svf_Base64ToString] (N'aQBuAHMAdQBzAC4AbgBlAHQAQAAtTv1W') GO
Source Code
原创文章,作者:254126420,如若转载,请注明出处:https://blog.ytso.com/tech/database/267401.html