Hello,
Currently I have connected database using windows authentication (default allow my windows creds). Ex: Server/User1
I need to create database using other windows credentials. Ex: Server/User2
The new database DBO rights should be Server/User2
Can help to achieve this scenario.
Let me know the SQL Query on this scenario.
Scenario explanation below:-
Step1:
Customer login system using them own user name and password (Ex:User Name: System\User1).
Step2:
Running one of the C# windows application exe. Application showing the DB Servername, DB Name, Login, Password.
Step3:
Enter Database server name Ex: (local)\SQLExpress
Enter Database name Ex: MyDatabase
Enter Database user name Ex: System\DBAdmin
Enter Database password Ex: **********
Note: System\DBAdmin already added localhost SQL Login (Security -> Login) with Sysadmin permission.
Step4:
Then successfully it should to create database for the login (System\DBAdmin)
Below should be expected after created database:-
1. Go to the SQL Sever Management Studio
2. Connect (local)\SQLExpress & Windows Authentication
3. Expand Databases -> MyDatabase should be created
4. Click MyDatabase and check below things:-
MyDatabase -> Security -> Users -> dbo -> General -> User type -> Windows User
MyDatabase -> Security -> Users -> dbo -> General -> Login name -> System\DBAdmin
Regards,
Vasanth
What I have tried:
I have added user under Login, tried to create database but no luck.