title: Copying BLOB values between databases with pure SQL in SQL Server
body: <p>I need to pull some BLOB data from a SQL Server 2005 database and generate a SQL script to insert this same data in another database, in another server.</p>
  
  <p>I am only allowed to do this using SQL scripts, I can't use any other utility or write a program in Java or .NET to do it.</p>
  
  <p>The other big restriction I have is that I don't have access to the original database (where the original BLOB data is) when I run the script, to copy the BLOB data to the target database, so the data should already be encoded within the SQL script file.</p>
  
  <p>Summing up: is there a way to encode the BLOB data into text so that I can dump it into a SQL INSERT command within a script text file and run it?</p>
  
  <p>I am able to run special T-SQL statements and stored procedures if needed to.</p>