简体   繁体   中英

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' in SQL Server 2008

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM