- 103ruby on rails,
- 49misc,
- 48designs,
- 42javascript,
- 33graphics and icons,
- 26css,
- 24tips and howtos,
- 23components,
- 21mac,
- 20tools,
14 Nov 07
Peter DeBetta's SQL Programming Blog : T-SQL UrlDecode
-
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(@url, @i + 1, 2)
SET @c = CHAR(CASE WHEN SUBSTRING(@cenc, 1, 1) LIKE '[0-9]'
THEN CAST(SUBSTRING(@cenc, 1, 1) as int)
ELSE CAST(ASCII(UPPER(SUBSTRING(@cenc, 1, 1)))-55 as int)
END * 16 +
CASE WHEN SUBSTRING(@cenc, 2, 1) LIKE '[0-9]'
THEN CAST(SUBSTRING(@cenc, 2, 1) as int)
ELSE CAST(ASCII(UPPER(SUBSTRING(@cenc, 2, 1)))-55 as int)
END)
SET @urlReturn = @urlReturn + @c
SET @i = @i + 2
END
ELSE
BEGIN
SET @urlReturn = @urlReturn + @c
END
SET @i = @i +1
END
RETURN @urlReturn
END
GO
Top Tags
Sponsored Links
Ads by Google
View All Recent Tags (40)
- 31ruby on rails,
- 15misc,
- 11business,
- 10mac,
- 8articles,
- 8blogs,
- 7tips and howtos,
- 7tips & howto,
- 6designs,
- 5plugins,
- 5apps,
- 5graphics and icons,
- 5links,
- 5comicly,
- 4web 2.0,
- 4components,
- 4tutorials,
- 3fedora,
- 3linux,
- 3ruby language,
- 3hosting,
- 3javascript,
- 3seo,
- 3case studies,
- 3fitness,
- 2design tutorials,
- 2css,
- 2fonts,
- 1apple,
- 1hackintosh,
- 1install,
- 1intel,
- 1leopard,
- 1osx,
- 1lists,
- 1tools,
- 1development,
- 1tips and tricks,
- 1people,
- 1templates
Public Tags (81)
startupguy 's Public Lists (0)
No lists have been created yet.
"List" is a great way to organize, share and display your specific collection of bookmarks.
Diigo is about better ways to research, share and collaborate on information. Learn more »
Join Diigo