Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 URLescape

Author  Topic 

Jenda
Starting Member

29 Posts

Posted - 2007-09-06 : 17:13:39
Is there any chance to find a function that'd escape a string for inclusion in a URL query?

SET @URL = 'http://www.some.com/script.pl?title=' + dbo.URLescape(@title) + '&email=' + dbo.URLescape( @email)


Doing the escaping outside the SQL is out of question, I need it within SQL :-(

Thanks, Jenda

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-09-06 : 17:18:55
Wow, you have great timing, a function to do this was posted here just in the last few days:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=88926

(the one by Kristen, a few posts in)

Can I ask why it needs to be done within SQL?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

Jenda
Starting Member

29 Posts

Posted - 2007-09-06 : 17:47:07
quote:
Originally posted by jsmith8858

Wow, you have great timing, a function to do this was posted here just in the last few days:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=88926
(the one by Kristen, a few posts in)


Sweet, just what I needed. Thanks!
(I swear I did try to search first.)

quote:

Can I ask why it needs to be done within SQL?

- Jeff



Because I need to use this within a system that let's me specify/compute the default value of some fields by specifying either a static value, one of the several types of default or specify a snippet of TSQL that computes the value. It was designed this way so that all the ASP pages and services did not have to worry whether a field already has a value or whether it's yet to be copied from somewhere or computed.

Doing this on a different level would mean several roundtrips to the database. In either case this is something that's so ingrained into the application that it can't be changed.
Go to Top of Page
   

- Advertisement -