I can't think of any easier way to do this than a throw away bit of C#...
static void Main(string[] args)
{
GetBinaryDataToFile("Server=localhost;Initial Catalog=ReportServer;Integrated Security=true", "D:\\temp.dat");
}
public static void GetBinaryDataToFile(string connectionString, string path)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
using (SqlCommand command = connection.CreateCommand())
{
command.CommandText = "SELECT Sid FROM Users WHERE UserID = '62066184-8403-494E-A571-438ABF938A4F'";
command.CommandType = CommandType.Text;
using (SqlDataReader dataReader = command.ExecuteReader())
{
if (dataReader.Read())
{
SqlBinary sqlBinary = dataReader.GetSqlBinary(0);
File.WriteAllBytes(path, sqlBinary.Value);
}
dataReader.Close();
}
}
connection.Close();
}
}
This code has been tested using the Users.Sid column (which is of varbinary type) in a default installation of SQL Server wih Reporting Services.