Saturday, May 11, 2019

How to Create and Drop Database in SQL server

Create Database:

There are several ways to create and drop a database in SQL servers using GUI or TSQL. Here I will show in both ways how to do it.

1)GUI - SSMS

Connect to SQL server using SSMS


Right Click on Database and click on "New database"

Provide the DatabaseName

also, you have the options to configure the database
->Restrict the DB size(Datafile and Logfile size)

->Set the DB owner

->Set the Recovery model
->Set the compatibility mode
->Set the collation


Click OK

Refresh the Database and you can see TESTDB created


2)T-SQL

Connect to SQL server using SSMS
Click on New Query and query to create new DB is

use [master]
go
Create Database [DatabaseName] -- Replace the [DatabaseName] with TESTDB
go

and click Execute





Drop Database:

1)GUI- SSMS

Connect to SQL server using SSMS

Expand Database section

Select the Database and right click
click on Delete

Click OK



2)T-SQL

Connect to SQL server using SSMS
Click on New Query and query to drop DB is

use [master]
go
Drop Database [DatabaseName] -- Replace the [DatabaseName] with TESTDB
go

and click Execute

Friday, May 3, 2019

SQL 2016 Developer Edition Installation Step by Step

SQL 2016 Developer Edition Installation Guide Step by Step

Download SQL 2016 developer edition setup file from the Microsoft Site.

Extract the downloaded setup file to a local folder

Run the setup.exe as administrator


Once the SQL server installation center opens, then click on the installation and choose New SQL Server stand-alone installation or add features to an existing installation


Follow the below steps for installation


  • Microsoft Update: check the box of 'Use Microsoft Update to check for updates' and click next


  • Install Rules: Check for any errors in the window and if you find any errors then need to take rectify it and click next once everything looks fine

  • Installation Type: Choose the "Perform the New SQL Installation" and click next


  • Product Key: Choose the Developer Edition or you need to enter the product key if its Enterprise edition. Click next

  • License Terms: Accept the License terms and click next
  • Feature Selection: Here need to select the appropriate features required, and for basic SQL setup needs to select the below features.


  • Instance Configuration: Select "Default Instance" to have the default instance name as  "MSSQLSERVER" or else select the "Named Instance" and provide the appropriate name

  • Server Configuration:  

  • 1)Service Account: Provide the domain level service account and password if you have any service accounts reserved for SQL services or else keep the default NTService accounts as below

  • 2)Collation: If the requirement is for different collation than MS default collation, then it can be changed  to the respective collation in this window as below

  • Database Engine Configuration:
1) Server Configuration: Choose the "Mixed Mode" and enter the password. This password is used for the SQL SA account. Add current user and optional group, users or service accounts can be added to SQL SysAdmin group by click on Add button.

2)Data Directories: Appropriate SQL Data Root, User DB Data, Log, Backup files path can be selected in below window

3)TempDB: SQL 2016 lets you configure TempDB as part of the installation itself


  • Ready To Install: Review the summary and click the install to proceed for installation


Once after successful installation, need to install SSMS separately and which can be downloaded from MSSite.