Reputation: 20509
I've been trying to export the contents of an XML variable to a file on my disk from SSMS (SQL Server Management Studio) with the following command.
EXEC xp_cmdshell 'bcp "SELECT @xml_file" queryout "C:\Radu\bcptest.txt" -T -c -t'
When running this command I'm constantly getting this error:
I've searched for answers and most of the things I found involved adding this NT AUTHORITY\NETWORK SERVICE
user to my database as a trusted user in SSMS, which would log in using Windows authentication, but this still didn't work.
I have also added roles as bulkadmin
and public
(in case of the user in Security->Logins path), db_datareader
, db_datawriter
and public
, access to the master
database which I am using (permission to connect, login), and also the same properties and permissions for the DB_BULK_IMPORT_User
, but without success.
I've also changed in IIS the Impersonation
of ASP .NET to enabled and restarted IIS server and the database server after each modification.
Is there something I'm missing? Or something I'm doing too much?
Thanks in advance!
Upvotes: 1
Views: 254
Reputation: 6651
-T
flag specifies that you are using a trusted connection using integrated security. You may want to drop the -T
and try specifying a username (-U
) and password (-P
).
Upvotes: 1