Is there a way in Easymorph to export to a binary file the content of a varbinary column from sql server ? I mean an action like "Export as binary" ? It can be done in various languages but why not Easymorph ? I want to avoid powershell script, something native in the tool.
Use case : I am currently reading the content of the sql server database of a power bi on premise platform to backup its file content (.pbix / .rdl).
I'm afraid it's not just export. To export something binary EasyMorph needs to be able to import binary values first. However, currently, binary data in cells isn't supported. Importing binary data as text isn't guaranteed to work, as some byte combinations can be illegal in the UTF-16 text encoding used internally for text representation.
The only way to make it work that I can think of is to use in EasyMorph an SQL query with a cast to base-64, but then you'd still need PowerShell to write base-64 values as binary files.
Here is a (rather straightforward) script generated by ChatGPT that uses the $input variable through which EasyMorph passes data to PowerShell:
# Output file path (change this to your desired location)
$outputFile = "C:\path\to\output\file.bin"
# Convert the Base64 string to a byte array
$binaryData = [System.Convert]::FromBase64String($input)
# Write the byte array to a file
[System.IO.File]::WriteAllBytes($outputFile, $binaryData)