Login failed for user 'NT AUTHORITY\ANONYMOUS

2019-09-04 23:01发布

I am executing a script by using file like below:

EXEC master.dbo.xp_cmdshell 'sqlcmd -d TE07 -S ServerName -i D:\TE07.sql'

When executing the above line I am getting the below error:

Msg 18456, Level 14, State 1, Server WIN-T7NMRSDEBNP, Line 1
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

I have read a lot but I am not clear about this. In many articles it is define as a LinkedServer issue. Can anyone please suggest me.

1条回答
forever°为你锁心
2楼-- · 2019-09-04 23:31

We have to use username and password also while executing the sql file using cmdshell:

EXEC master.dbo.xp_cmdshell ‘sqlcmd -D db_name -S server_name -U username -P password -i sqlfile’

Use the above format

查看更多
登录 后发表回答