Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created April 11, 2016 11:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save justinyoo/a0fcf112bda27c09ac54747c56e5fe11 to your computer and use it in GitHub Desktop.
Azure SQL Pro Tip - Creating Login Account and User
IF EXISTS(SELECT * FROM sys.database_principals WHERE name = '<LOGIN_ACCOUNT>')
DROP USER [<LOGIN_ACCOUNT>]
DROP LOGIN [<LOGIN_ACCOUNT>]
GO
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'<LOGIN_ACCOUNT>')
CREATE LOGIN [<LOGIN_ACCOUNT>] WITH PASSWORD=N'<ACCOUNT_PASSWORD>'
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment