Transact SQL: exporting table or view in CSV
It's pretty easy on SQL Server but pay attention to the database/server rights of used connection. Usually, the preparing like sp_configure
requires a system administrator privileges.
Activate "xp_cmdshell" option (only once)
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;
Create and run wrapping stored procedure …