Click here to Skip to main content
15,883,883 members
Articles / SQLEXPRESS
Tip/Trick

Enabling SQL Express User

Rate me:
Please Sign up or sign in to vote.
2.83/5 (3 votes)
22 Aug 2017CPOL1 min read 11.8K   4
How to enable SQL Express user

Visual Studio(VS) lovers! Yes, we want to work on everything from within the VS. Yes, of course, our VS have required features to support us to perform various development and ALM operations. Database is one of the main parts of any application development. Instead of working on the database objects using SQL Server Management Studio, we prefer to use VS. Access the database directly from VS using the SQL Server Object Explorer. Moreover, we would like to work with the SQL express instead of connecting to a centralized database server for small project or at the starting of a project.

Even though we have Admin access, most of the time, we end up with permission issues in database level. This prevents us from create a database in SQL Express.

If you have Admin privilege in system, we can quickly fix this issue. Go to your services using Start> Run> services.msc. Locate the SQL Server (SQLEXPRESS) service from the list of services.

Right click and select Properties.

Image 1

Stop the service using the Stop option in the Properties window, if not stopped. Now, enter -m into the Start parameters text box to start the SQL express service in Single used mode.

Image 2

Start the service using Start option in the Properties window.

Go to command prompt using Start>Run>cmd and run the following commands to add the domain user as a sysadmin to SQL express.

Note: Replace domain\user with the corresponding domain user information before running the following command.

osql -S .\sqlexpress -E
create login [domain\user] from windows
go
exec sp_addsrvrolemember @loginame= ‘domain\user’, @rolename='sysadmin'
go

Once the command execution completes, navigate back to the services window and stop the SQL Express service. Remove -m from Start parameters and start the SQL express service to support multiple users.

Now, we can create a new database using Visual Studio’s SQL Server Object Explorer and perform our database operations.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect TCS
India India
I have over 10 years of experience working on Microsoft Technologies. I am carrying the passion on Microsoft technologies specifically on web technologies such as ASP.Net, HTML5, jQuery and Ajax. My interests also include TFS, Azure, Windows 8, Visual Studio 2010. Technology adoption and learning is my key strength and technology sharing is my passion.

Microsoft MVP: Connected Service Developer

Comments and Discussions

 
GeneralMy vote of 5 Pin
Member 1236439024-Aug-17 21:46
Member 1236439024-Aug-17 21:46 
thanks for the useful tip
QuestionThoughts Pin
Wendelius23-Aug-17 5:17
mentorWendelius23-Aug-17 5:17 
AnswerRe: Thoughts Pin
ambilykk23-Aug-17 20:10
ambilykk23-Aug-17 20:10 
GeneralRe: Thoughts Pin
Wendelius24-Aug-17 6:05
mentorWendelius24-Aug-17 6:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.