I have a view created by OPENDATASOURCE. The view is
FROM OPENDATASOURCE ('SQLNCLI','Data Source = mydatasource;trusted_connection=yes')
Randomly I get the following error when I run a select on the view from my workstation.
Msg 18456, Level 14, State 1, Line 1
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
OLE DB provider "SQLNCLI" for linked server "(null)" returned message "Invalid connection string attribute".
If I immediately log into the server and run it there (with no problems) I can jump back to my desktop and run it (almost like I cleaning out some memory or something).
So I wanted to see if there was an execution count that would trigger the error. I ran a loop selecting * from the view for well over an hour on my machine.. The query was executed over 225,000 times. When it was done, I ran the select statement alone ~5 times with no problems. I leave my session for a few minutes I come back and get the error again and of course log into the server run it come back…no problems.