I want to write a SQL 2005 script to create a new login using Windows authentication. A Windows user is a local account (not a domain account). A local account with the same name exists on many SQL Server machines, and I want to run the same script for all of them.
It seemed simple enough:
CREATE LOGIN [MyUser]
FROM WINDOWS
However, this does not work! SQL returns an error sayingGive the complete name: <domain\username>.
Of course, I can do this for one machine, and it works, but the same script will not work on other machines.
source
share