When trying to automate some SQL Server Database commands, such as a BCP command to execute a .SQL file and SQL statements within a Uproc in Dollar Universe, we are getting an error:
C:\Universe\bin>BCP dbo.ONE_LINE_TASK IN "C:\AIOD\Uproc\All_Task.txt" -S XXX -U USERNAME -P PASSWORD -d UNIVERSE -T -c -t "\r\n"
SQLState = 28000, NativeError = 18452
Error = [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication.
Launching the same command in the command line window directly from the Server works fine, what could be the reason?
Parameter -T should not be used when using the parameters -U and -P, as Dollar Universe launches the script in batch mode with the user defined in the Submission Account that, by default, will be mapped to LocalSystem and not a Domain User.
Check the extract from the Microsoft doc here
Release : 6.x
Component : DOLLAR UNIVERSE
Third-party: MS SQL Server
To fix the issue, it was required to remove the parameter -T from the BCP Uproc Script to allow to launch the command via a Dollar Universe Uproc.
Example of working script:
C:\Universe\bin>BCP dbo.ONE_LINE_TASK IN "C:\AIOD\Uproc\All_Task.txt" -S xxx -U xxx -P xxx ! -d UNIVERSE -c -t "\r\n"
224 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 62 Average : (3612.90 rows per sec.)