Can a SQL query write to an encrypted excel file?
If not, how can we query data and send it in files while ensuring the data is always encrypted.
This is a big deal because it contains PII relating to legal matters.
Background
I am not a SQL user - I am a sysadmin and I don't know much inside SQL.
We are custodians of data that belongs to other orgs, and we will soon need to regularly send encrypted files containing data from a query to the various owners.
One of the owners raised an issue that if the data is queried from SQL, and the file is encrypted afterwards (but before sending), then the data must have been written to disk in plaintext (and that is not acceptable).
If the SQL query can write to an encrypted file (we currently plan to send as Excel with the native AES256 encryption), then I need to point our data team to this method and have them adopt it.
If a SQL query cannot write to an encrypted file, then the solution I see is to have the query run from a dedicated VM with full disk encryption. That way we can show the data is always in an encrypted container: initially the virtual hdd, then the encrypted Excel file.
Thanks