Collections:
"CREATE USER" - Creating a User Name in a Database in SQL Server
How To Create a User Name in a Database in SQL Server?
✍: FYIcenter.com
User names are security principals at the database level. If you want to allow a login name to access a specific database, you need to create a user name in that database and link it to the login name.
Creating a user name can be done by using the "CREATE USER" statement as shown in this tutorial exercise:
-- Login with "sa" -- Create a login CREATE LOGIN Fyi_Login WITH PASSWORD = 'IYF' GO -- Select a database USE FyiCenterData; GO -- Create a user and link it to a login CREATE USER Fyi_User FOR LOGIN Fyi_Login; GO
Login name "Fyi_Login" should be able to access database "FyiCenterData" through user name "Fyi_User".
⇒ sys.database_principals - Listing All User Names in SQL Server
⇐ "DROP LOGIN" - Deleting a Login Name in SQL Server
2016-10-19, 2507🔥, 0💬
Popular Posts:
How To List All Login Names on the Server in SQL Server? If you want to see a list of all login name...
How to download and install SQL Server 2005 Sample Scripts in SQL Server? If you want to learn from ...
How To List All Login Names on the Server in SQL Server? If you want to see a list of all login name...
How To Verify a User name with SQLCMD Tool in SQL Server? The quickest way to verify a user name in ...
How To Generate CREATE TABLE Script on an Existing Table in SQL Server? If you want to know how an e...