QuickQuestion: How to uninstall a SQL Server feature?

QuickQuestion series is a series of short posts in which I answer database related questions asked by my colleagues, friends, and co-workers, mainly application developers.

Today’s question:

How to uninstall a SQL Server feature?

Continue reading “QuickQuestion: How to uninstall a SQL Server feature?”

Share it:
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

QuickQuestion: How to start and stop SQL Server instance from a command line?

QuickQuestion series is a series of short posts in which I answer database related questions asked by my colleagues, friends, and co-workers, mainly application developers.

Today’s question:

How to start and stop SQL Server instance from a command line?

Windows

SQL Server instance as any other Windows network service can be managed using the NETcommand from elevated Command Prompt (Run as Administrator).

net options

To start default SQL Server instance use following command:

net start "SQL Server (MSSQLSERVER)"

or

net start MSSQLSERVER

To start named SQL Server instance use following command:

net start "SQL Server ( instancename )"

or

net start MSSQL$ instancename

SQLServer - net start

To stop default SQL Server instance use following command:

net stop "SQL Server (MSSQLSERVER)"

or

net stop MSSQLSERVER

To stop named SQL Server instance use following command:

net stop "SQL Server ( instancename )"

or

net stop MSSQL$ instancename

SQLServer - net stop

To restart instance you need to first stop it and then start it.  On Windows, there is no one single command that can be used for this purpose.

Linux (RHEL and Ubuntu)

On Linux, we don’t have yet named instances, so all commands are executed against default instance. SQL Server can be managed using thesystemctl command.

To check the current state of SQL Server instance you can run this command:

sudo systemctl status mssql-server

To start instance run following command:

sudo systemctl start mssql-server

SQLServer - systemctl start

To stop instance run following command:

sudo systemctl stop mssql-server

SQLServer - systemctl stop

To restart instance run following command:

sudo systemctl restart mssql-server
Docker

Docker provides us a very similar set of commands.

To start container run following command:

docker start <container ID>

SQLServer - docker start

To stop container run following command:

docker stop <container ID>

SQLServer - docker stop

To restart container run following command:

docker restart <container ID>

-Marek

Share it:
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

QuickQuestion: How to enable a trace flag on SQL Server startup?

QuickQuestion series is a series of short posts in which I answer database related questions asked by my colleagues, friends, and co-workers, mainly application developers.

Today’s question:

How to enable a trace flag on SQL Server startup?

If you want to have a certain Trace Flag enabled after every SQL Server startup, then you have to set it as one of SQL Server startup parameters. To do that you need to execute few simple steps.

  1. Open SQL Server Configuration Manager (as Administrator).
    TraceFlag - SQLServer Configuration Manager
  2. Open Properties of the SQL Server instance you want to configure.
    TraceFlag - SQLServer Configuration Manager - properties 1
  3. As a next step, go to Startup Parameters tab. Provide new startup parameter. For Trace Flag it will be -T#### (where #### needs to be replaced with Trace Flag number). Click Add button.
    TraceFlag - SQLServer Configuration Manager - startup parameters
  4. Notice that additional parameter was added to the parameters list. Click Apply button.
    TraceFlag - SQLServer Configuration Manager - startup parameters 2
  5. You will get the warning that SQL Server instance needs to be restarted in order the change takes effect.
    TraceFlag - SQLServer Configuration Manager - startup parameters 3
  6. Finally, you have to restart your SQL Server instance.
    TraceFlag - SQLServer Configuration Manager - restart

That’s it.

-Marek

Share it:
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

QuickQuestion: Can I mock a table in another DB using tSQLt?

QuickQuestion series is a series of short posts in which I answer database related questions asked by my colleagues, friends, and co-workers, mainly application developers.

Today’s question:

Can I mock a table in another database using tSQLt?

Continue reading “QuickQuestion: Can I mock a table in another DB using tSQLt?”

Share it:
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

QuickQuestion: Stored Procedure with multiple result sets

QuickQuestion series is a series of short posts in which I answer database related questions asked by my colleagues, friends, and co-workers, mainly application developers.

Today’s question:

Is it OK to create a Stored Procedure that returns two result sets?

Continue reading “QuickQuestion: Stored Procedure with multiple result sets”

Share it:
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

QuickQuestion: Can I add column with IDENTITY property to existing table with data?

QuickQuestion series is a series of short posts in which I answer database related questions asked by my colleagues, friends, and co-workers, mainly application developers.

Today’s question:

Can I add column with IDENTITY property to existing table with data?

Continue reading “QuickQuestion: Can I add column with IDENTITY property to existing table with data?”

Share it:
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

QuickQuestion: Can you create two #SameName temp tables in a single session?

QuickQuestion series is a series of short posts in which I answer database related questions asked by my colleagues, friends, and co-workers, mainly application developers.

Today’s question:

Can you create two #SameName temp tables in a single session?

Continue reading “QuickQuestion: Can you create two #SameName temp tables in a single session?”

Share it:
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

QuickQuestion: When Stored Procedure break execution on error?

QuickQuestion series is a series of short posts in which I answer database related questions asked by my colleagues, friends, and co-workers, mainly application developers.

Today’s question:

When Stored Procedure break execution on error?

Continue reading “QuickQuestion: When Stored Procedure break execution on error?”

Share it:
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

QuickQuestion: Does Stored Procedure rollback on error?

QuickQuestion series is a series of short posts in which I answer database related questions asked by my colleagues, friends and co-workers, mainly application developers.

Today’s question:

Does Stored Procedure rollback on error?

Continue reading “QuickQuestion: Does Stored Procedure rollback on error?”

Share it:
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close