From an internal application-server context with authorized SQL Server connectivity and a read-capable database principal, query selected records to a local file, create a password-protected 7z archive, and transfer it to an authorized SFTP destination. This procedure assumes database credentials are already available; it does not exploit SQL injection or acquire application credentials.
Variant:
Query and Save Results to a Local CSV
powershell
RESTRICTED_ACCESS_BLUR_MARKER
RESTRICTED_ACCESS_BLUR_MARKER
RESTRICTED_ACCESS_BLUR_MARKER
RESTRICTED_ACCESS_BLUR_MARKER