Solved

Convert url to base64

Posted on 2011-03-14
2
769 Views
Last Modified: 2012-05-11
In SQL 2008 I have a table that I want to insert a record into that has a column whose data consists of xml type elements. One of the elements I want to add is a url, which contains what SQL considers invalid characters - '&' and so on.  How would I go about converting this url to a base64 string so that I can store it that way in this record.
This is similar to what the data would look like:
<ConnectionString>"http://data.acme.com/data.xml?system=blahblah%20&key=FED4AA86-4960-49DE-83B5-6CBC0B68BC69&type=1&version=1.0"</ConnectionString>
0
Comment
Question by:MEINMEL
2 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
0
 
LVL 23

Expert Comment

by:wdosanjos
Comment Utility
Try something like this:

select 'http://data.acme.com/data.xml?system=blahblah%20&key=FED4AA86-4960-49DE-83B5-6CBC0B68BC69&type=1&version=1.0' 
    as 'ConnectionString' 
for xml raw(''), elements

Open in new window


The result is:
<ConnectionString>http://data.acme.com/data.xml?system=blahblah%20&amp;key=FED4AA86-4960-49DE-83B5-6CBC0B68BC69&amp;type=1&amp;version=1.0</ConnectionString>

I hope this helps.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now