Setting up T-SQL
Download MS SQL Express 2014 with Tools
- Follow link here.
- Select language.
- Click download.
- Check ExpressAndTools 64BIT\SQLEXPRWT_x64_ENU.exe and download.
Install
- Unless you have reason otherwise, select "New SQL Server stand-alone installation..." when prompted.
- Accept license terms when prompted.
- On Feature Selection window, ensure that you select LocalDB in addition to the
default selections.
- On Instance Configuration window, ensure that you remember the named instance
and Instance ID if you choose to change them. I recommend the default.
- Unless you have reason otherwise, press Next on Server Configuration screen.
Setup Local Server Instance
- Open SQL Server Management Studio.
- Click Cancel when prompted.
- Go to View -> Registered Servers
- A Registered Servers window should open with a "Database Engine." Expand the
Database Engine by pressing the + symbol.
- Right-click on Local Server Groups.
- Tasks -> Register Local Servers
- It should register one server, which will now display under Local Server Groups.
- When you exit Management Studio and re-open it, the local server should be the default connection.
Here's the MS website for setting this up.
Download AdventureWorks 2014
This is a sample database provided by MS.
- Follow link here.
- Under "To install AdventureWorks", click the link under number (2), "download AdventureWorks-oltp-install-script.zip".
- Create a folder Samples on your C:\ drive. Within the Samples folder, create a folder called AdventureWorks. Move or extract all files to from the download to this file (file path: C:\Samples\AdventureWorks\).
- Once connected to SSMS, open the file instawdb.sql within C:\Samples\AdventureWorks\
- Click the Query menu at top of the toolbar and select SQLCMD mode. This is the command mode for SQL.
- Run the query by pressing F5 or pressing the execute button.
- The code will execute with errors. This is because we do not have full-text search
enabled.
- Ensure that you can see an AdventureWorks database and tables, shown below.
Debugging:
- If the code generate errors immediately upon executing, make sure the SQLCMD mode is selected and that you are connected to your server instance.
- If the tables are empty, make sure all files are extracted in C:\Samples\AdventureWorks\. If you did not extract them here, you will need to
manipulate the folder path in the script. See step 6 in the same section here (under "Download AdventureWorks 2014").
If they are still showing empty, ensure that you refesh your server instance by
pressing refresh the refresh button in the Object Explorer (hotkey F5).
Download Accompanying Files for Ben-Gan
These are files to accompany T-SQL Fundamentals., 3rd ed. by Itzik Ben-Gan
- Follow link here.
- The zip file is a collection of scripts for each chapter. If running these scripts are required, the
steps will be reviewed together with the concepts.