SQL Search Latest version: 1.0
Knowledge Base
Login failing with "trusted SQL Server connection" error when using RunAs
Category: Troubleshooting & error messages
Date: 28 Dec 2009
Product: all SQL products
Platforms: Windows Vista, Server 2008, Windows 7
When launching any Red Gate desktop SQL tool, such as SQL Compare or Data Compare, using the "RunAs" option to run it as a different user, the following error may occur:
"Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection"
The problem occurs because Windows is not passing the default Windows credentials through the connection to the SQL Server, resulting in an anonymous login. If it's necessary to use "RunAs" to run the tool for security reasons, you can get Windows to pass the impersonated credentials by running the tool from an administrator command prompt and using RunAs with the "/netonly" switch.
For instance, to run SQL Compare using the "/netonly" option, open a new command prompt as administrator and use the following command:
RunAs /user:MyUserName /netonly "%programfiles%\red gate\sql compare 8\RedGate.SQLCompare.UI.exe"
