SQL Server Url Decoding
问题 I need to run a query against a legacy table that stores URL encoded text. I need this text to be decoded in my results. How do I achieve this? 回答1: Try one of these: CREATE FUNCTION dbo.UrlDecode(@url varchar(3072)) RETURNS varchar(3072) AS BEGIN DECLARE @count int, @c char(1), @cenc char(2), @i int, @urlReturn varchar(3072) SET @count = Len(@url) SET @i = 1 SET @urlReturn = '' WHILE (@i <= @count) BEGIN SET @c = substring(@url, @i, 1) IF @c LIKE '[!%]' ESCAPE '!' BEGIN SET @cenc = substring