Skip to main content

Tools Setup – SQL Server, SSMS, .NET 10, Visual Studio and Git | Lesson 4

Published / updated

Introduction​

In this lesson, you install every tool the course uses and prove that each one works. At the end, you create the first piece of the project: an empty database called SchoolDb.

All the tools are free. You install them once and use them for the rest of the course.

By the end of this lesson, you will be able to:

  • Install SQL Server 2022, SSMS, the .NET 10 SDK, Visual Studio, and Git.
  • Check each tool from the command line.
  • Connect SSMS to your SQL Server.
  • Run a script that creates the SchoolDb database, safely, more than once.

Why this matters​

Half of the problems beginners post online are setup problems: a missing tool, a wrong version, or a server name typed wrongly. Each one can waste a whole evening.

If you check every tool now, any later error is about your code, not your machine. You will also learn to write a script that can run twice without breaking. Every database script in this course follows that rule.

The concept​

A developer's tools are like a carpenter's toolbox. Each tool has one job. You do not use a hammer to measure a table.

Example: the tools and their jobs​

ToolWhat it isIts job in this course
SQL Server 2022A database server: a program that stores data and answers queriesStores SchoolDb
SSMSSQL Server Management Studio: a window for working with SQL ServerWrite and run SQL, see tables
sqlcmdA command-line tool that runs SQL scriptsRebuild the database with one command
.NET 10 SDKThe SDK (Software Development Kit): compiler and tools to build C# appsBuild and run C# from Module 6
Visual Studio 2026An IDE (Integrated Development Environment): an editor with a debuggerWrite and debug C#
GitA version control tool: it saves the history of your codeGet the code for any lesson

Two pairs confuse many beginners:

  • SQL Server vs SSMS. SQL Server is the database server; it runs in the background. SSMS is only a window that connects to it. You can uninstall SSMS and your data stays.
  • SDK vs runtime. The runtime only runs finished .NET apps. The SDK includes the runtime plus the tools to build apps. Developers install the SDK.

Example: which .NET version and why​

.NET has two kinds of releases. LTS (Long Term Support) versions get fixes for 3 years. STS (Standard Term Support) versions get fixes for 2 years.

.NET 10 is an LTS release, so it is the safe choice for a school system that must run for years.

Apply it to the SMS​

Open Windows Terminal (or Command Prompt). The commands below use winget, the Windows package manager that comes with Windows 11. If you prefer, download each tool from its official website instead.

Step 1: install SQL Server 2022 Developer edition​

The Developer edition has every feature of the paid edition and is free for learning and development. It must not be used for a real school's live data.

Install SQL Server 2022 Developer
winget install --id Microsoft.SQLServer.2022.Developer -e

During setup, choose Basic installation. When it finishes, your server name is localhost.

Low on memory? Use LocalDB instead: a small version of SQL Server that Visual Studio installs (Step 4, "Data storage and processing" workload). Its server name is (localdb)\MSSQLLocalDB.

LocalDB works for Modules 2 to 4. Lessons that need the full server will say so.

Step 2: install SSMS and sqlcmd​

Install SSMS 21 and sqlcmd
winget install --id Microsoft.SQLServerManagementStudio.21 -e
winget install --id Microsoft.Sqlcmd -e

Step 3: install the .NET 10 SDK​

Install .NET 10 SDK
winget install --id Microsoft.DotNet.SDK.10 -e

Step 4: install Visual Studio 2026 Community​

Install Visual Studio Community
winget install --id Microsoft.VisualStudio.Community -e

When the Visual Studio Installer opens, tick two workloads (bundles of features): ASP.NET and web development and Data storage and processing. Then click Install.

Step 5: install Git and set your name​

Install Git
winget install --id Git.Git -e

Close and reopen the terminal, then tell Git who you are. Use your own name and email.

Configure Git
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Example: check every tool​

Close and reopen the terminal so it finds the new tools. Then run:

Check the tools
dotnet --version
git --version
sqlcmd -S localhost -E -C -h -1 -Q "SET NOCOUNT ON; SELECT CAST(SERVERPROPERTY('ProductVersion') AS VARCHAR(20));"
Output
10.0.100
git version 2.51.0.windows.1
16.0.1000.6

Your version numbers can be higher. What matters: dotnet starts with 10, and SQL Server 2022 starts with 16.

The sqlcmd options mean:

  • -S localhost: the server name.
  • -E: log in with my Windows account.
  • -C: trust the server's certificate.
  • -h -1: hide the column headings.
  • -Q: run one query and exit.

If you chose LocalDB, replace localhost with "(localdb)\MSSQLLocalDB".

Step 6: connect SSMS​

  1. Open SQL Server Management Studio 21.
  2. In Connect to Server, enter Server name localhost (or (localdb)\MSSQLLocalDB).
  3. Authentication: Windows Authentication.
  4. Tick Trust server certificate, then click Connect.

You now see your server in Object Explorer on the left.

Before continuing, check these four parts of the SSMS window:

PartWhere to find itWhat success looks like
Object ExplorerLeft sideYour server name has a green connected icon
DatabasesUnder your serverThe folder expands without an error
New QueryTop toolbarA blank query tab opens
Database listAbove the query editorIt shows master until you select another database

If Object Explorer is hidden, press F8. If your server is disconnected, click Connect > Database Engine at the top of Object Explorer. Do not continue until the Databases folder opens.

Example: create SchoolDb​

Create a folder for the project, for example C:\Projects\SMSCOURSE, with a database folder inside it. Save this script as database\004-create-database.sql.

database/004-create-database.sql
-- Lesson 4: create the empty SchoolDb database.
-- Safe to run more than once: it only creates SchoolDb if it does not exist yet.

IF DB_ID(N'SchoolDb') IS NULL
BEGIN
CREATE DATABASE SchoolDb;
END;
GO

USE SchoolDb;
GO

-- Confirm where you are connected and which SQL Server you are running.
SELECT
CAST(DB_NAME() AS VARCHAR(20)) AS DatabaseName,
CAST(SERVERPROPERTY('ProductVersion') AS VARCHAR(20)) AS ProductVersion,
CAST(SERVERPROPERTY('Edition') AS VARCHAR(40)) AS Edition;
GO

What each part does:

  • DB_ID(N'SchoolDb') returns the database's ID number, or NULL if it does not exist.
  • IF ... IS NULL runs CREATE DATABASE only when the database is missing. This makes the script re-runnable: running it a second time does nothing harmful.
  • GO is not SQL. It tells SSMS and sqlcmd "send everything above as one batch".
  • USE SchoolDb; switches to the new database.
  • The last SELECT shows where you are and which server you are on. CAST(... AS VARCHAR(20)) only keeps the columns narrow in the output.

In SSMS, open the file (File > Open > File) and press F5 to run it.

DatabaseNameProductVersionEdition
SchoolDb16.0.1000.6Developer Edition (64-bit)

Press F5 again. You get the same result and no error: the re-runnable rule is working.

In Object Explorer, right-click Databases and choose Refresh to see SchoolDb.

The query editor can run all text or only selected text. With no selection, F5 runs the whole tab. When text is selected, F5 runs only that selection.

Check the database list before every run. A new query tab may start in master.

Example: rebuild with one command​

As the course grows, database will hold one script per lesson. This small batch file runs them all in number order. Save it as database\run-all.cmd.

database/run-all.cmd
@echo off
rem Builds SchoolDb by running every database\NNN-*.sql script in order.
rem Usage: database\run-all.cmd (server: localhost)
rem database\run-all.cmd "(localdb)\MSSQLLocalDB"
setlocal

set "SERVER=%~1"
if "%SERVER%"=="" set "SERVER=localhost"

where sqlcmd >nul 2>nul
if errorlevel 1 (
echo sqlcmd was not found. Install it with: winget install Microsoft.Sqlcmd
exit /b 1
)

echo Server: %SERVER%
for /f "delims=" %%F in ('dir /b /on "%~dp0???-*.sql"') do (
echo Running %%F
sqlcmd -S "%SERVER%" -E -C -b -i "%~dp0%%F"
if errorlevel 1 (
echo FAILED: %%F
exit /b 1
)
)

echo Done. SchoolDb is up to date.
endlocal

Run it from the project folder:

Rebuild the database
database\run-all.cmd
Output
Server: localhost
Running 004-create-database.sql
Changed database context to 'SchoolDb'.
DatabaseName ProductVersion Edition
-------------------- -------------------- ----------------------------------------
SchoolDb 16.0.1000.6 Developer Edition (64-bit)

(1 rows affected)
Done. SchoolDb is up to date.

The -b option stops at the first error, so a broken script never goes unnoticed.

Example: get the code for any lesson​

You can also download the finished code instead of typing it. The Resources section of every lesson has the repository link. Clone it once with git clone followed by that link, then move to any lesson with its tag:

Load the code for Lesson 4
cd SMSCOURSE
git checkout lesson-4-tools-setup

A tag is a named point in the code's history. git checkout loads the files exactly as they were at that point. Typing the code yourself teaches more; use the tags when you get stuck or join late.

Common mistakes​

  1. Not reopening the terminal after installing. The old window does not know the new tools, so you see "not recognized". Fix: close and reopen the terminal.
  2. Wrong server name in SSMS. A default install is localhost; LocalDB is (localdb)\MSSQLLocalDB. Fix: copy the name exactly, including the brackets.
  3. Certificate error when connecting. New SSMS versions encrypt connections by default. Fix: tick Trust server certificate (on your own machine only).
  4. Installing the runtime instead of the SDK. dotnet --version then fails or cannot build. Fix: install the SDK.
  5. Writing scripts that fail on the second run. CREATE DATABASE alone fails if the database exists. Fix: check first with IF DB_ID(...) IS NULL.

In real projects​

From 16 years of .NET projects

"It works on my machine" is the most common sentence in a new team, and it is almost always a version difference. On real projects, the team agrees on exact versions of the .NET SDK, SQL Server, and even Visual Studio. They write them in the repository's README, and new joiners follow that page on day one.

The same goes for database scripts. In production, deployment tools run them, sometimes twice by accident.

Every script my teams ship can run twice without damage. You started that habit today with IF DB_ID(...) IS NULL.

Best practices​

  • Check every tool with a version command before you start coding.
  • Use the Developer edition for learning; never for a live school's data.
  • Make every database script re-runnable.
  • Keep all scripts in the database folder, numbered in the order they run.

Recap​

  • SQL Server stores data; SSMS is a window into it.
  • The SDK builds .NET apps; the runtime only runs them.
  • .NET 10 is an LTS release with 3 years of fixes.
  • localhost is a default SQL Server; (localdb)\MSSQLLocalDB is LocalDB.
  • IF DB_ID(N'SchoolDb') IS NULL makes the create script re-runnable.
  • run-all.cmd rebuilds the database from every script in order.

Homework​

Library module task: The school library needs tables for books, copies, and issues. Should these tables go in SchoolDb or in a new LibraryDb database? Write down your choice and three reasons.

A correct result looks like: a clear choice with three reasons that mention how library data connects to school data.

Show a sample solution

Put the Library tables in SchoolDb:

  1. Book issues point to students. A foreign key (a rule that links two tables, Lesson 10) only works inside one database.
  2. One backup protects all school data together, so library and student records never get out of step.
  3. One connection string and one set of user permissions are simpler to manage.

A separate database makes sense only when another team owns it, or it must scale or be secured completely separately.

Quiz​

  1. What is SSMS?

    1. The database server itself
    2. A window (client tool) for working with SQL Server
    3. A C# compiler
    4. A version control tool
    Show answer

    Answer: B. A window (client tool) for working with SQL Server SQL Server stores the data; SSMS only connects to it.

  2. Which should a developer install to build C# applications?

    1. The .NET runtime
    2. The .NET SDK
    3. SSMS
    4. sqlcmd
    Show answer

    Answer: B. The .NET SDK The SDK includes the compiler and tools; the runtime only runs apps.

  3. Why does the script use IF DB_ID(N'SchoolDb') IS NULL?

    1. To make it run faster
    2. To delete the old database
    3. So it can run twice without an error
    4. Because GO requires it
    Show answer

    Answer: C. So it can run twice without an error It creates the database only when it is missing, so the script is re-runnable.

  4. What is the server name of a LocalDB instance?

    1. localhost
    2. (localdb)\MSSQLLocalDB
    3. sqlserver
    4. 127.0.0.1\SchoolDb
    Show answer

    Answer: B. (localdb)\MSSQLLocalDB LocalDB uses (localdb)\MSSQLLocalDB; a default SQL Server uses localhost.

  5. What does GO do in a SQL script?

    1. It runs the program
    2. It ends a batch, so the tool sends the statements above it
    3. It creates a database
    4. It commits a transaction
    Show answer

    Answer: B. It ends a batch, so the tool sends the statements above it GO is a batch separator understood by SSMS and sqlcmd, not a SQL command.

Interview questions​

Questions are grouped by experience level. Click a question to see a model answer. All questions: Architecture interview questions, C# interview questions, SQL Server interview questions.

Fresher (0-2 yrs)​

F What is the difference between the .NET SDK and the .NET runtime? concept

The runtime only runs .NET applications that are already built. The SDK (Software Development Kit) contains the runtime plus the compiler and the dotnet command-line tools to create, build, test, and publish applications. Developers install the SDK; servers that only run the app need just the runtime.

See the example · Permalink

F What is the difference between SQL Server and SSMS? concept

SQL Server is the database server: a service that stores the data and runs queries. SSMS (SQL Server Management Studio) is a client tool that connects to SQL Server so you can write queries and manage objects. Uninstalling SSMS does not touch your data.

See the example · Permalink

F What is LocalDB, and when would you use it instead of the Developer edition? concept

LocalDB is a lightweight version of SQL Server that starts on demand and needs no service setup; its server name is (localdb)\MSSQLLocalDB. It suits laptops with little memory and simple development. The Developer edition is a full server with every feature, such as SQL Server Agent, so it is better for realistic development and testing.

See the example · Permalink

Mid (3-5 yrs)​

M What is the difference between LTS and STS releases of .NET, and which would you choose for a production system? concept

LTS (Long Term Support) releases, such as .NET 10, get fixes and security patches for 3 years. STS (Standard Term Support) releases get them for 2 years. For a production system that must run for years, like a school system, choose LTS and plan upgrades from one LTS to the next.

See the example · Permalink

M How do you write a database script that can run more than once without errors? coding

Check before you create or change anything. Use IF DB_ID(N'SchoolDb') IS NULL before CREATE DATABASE, IF OBJECT_ID(N'dbo.Students') IS NULL before CREATE TABLE, and CREATE OR ALTER for views and procedures. Such scripts are called idempotent: running them twice leaves the same result as running them once.

See the example · Permalink

M What does GO do in a SQL script? concept

GO is not a T-SQL command; SSMS and sqlcmd use it to split a script into batches and send each batch separately. Some statements, such as CREATE VIEW or CREATE PROCEDURE, must be the first statement in a batch. Variables declared before a GO do not exist after it.

See the example · Permalink

Senior (6-9 yrs)​

S The code works on your machine but fails on the test server. How do you investigate? scenario

Compare everything that can differ: tool and runtime versions, configuration and connection strings, environment variables, database data and schema, and permissions. Read the server's logs for the exact error, then reproduce it locally with the same settings. Most cases come down to a version or configuration difference.

How to answer: Give a structured checklist (versions, configuration, data, permissions, logs) rather than guesses. Use an SMS example: the test server runs an older SQL Server or a different connection string. Finish with prevention: pinned versions written in the README, the same database scripts for every environment, and configuration kept out of code.

See the example · Permalink

S Which SQL Server edition would you use for development, testing, and the school's live server? design

Developer edition for development and testing: it has every feature and is free, but it is licensed only for non-production use. For the live server, Express is free but limited (for example, 10 GB per database). Most real schools need Standard edition, or a managed cloud database, depending on size, availability needs, and budget.

How to answer: Separate the three environments and the licensing rule first. Size the SMS: one school's data fits Express for years, but 1,000 schools does not. Then weigh the trade-off: Express saves cost but has no SQL Server Agent for scheduled backups, so you would need another way to schedule them; Standard or a managed service costs more but handles backups and availability for you.

See the example · Permalink

Resources​

  • Code for this lesson: git tag lesson-4-tools-setup (code repository coming soon)
  • Files: database/004-create-database.sql, database/run-all.cmd
  • Video: coming soon

What's next​

Your tools work and SchoolDb exists. Module 2 starts with how a relational database organizes data. Lesson 5: RDBMS concepts and SSMS

Want live sessions, code reviews, and interview preparation? Join the next batch at Sahasra Technologies.