Advanced SQL

£800 per delegate. This may be less for special offers on specific course dates and in-company training courses

Duration: 2 days

Trainer: S047OW

Need course dates or locations to suit you? CLICK HERE TO SEND ENQUIRY...


If you already know how to write SELECT statements in SQL, maybe it's time to find out how to program in SQL! Learn how to create stored procedures (including passing parameters to them), write your own user-defined functions, work with temporary tables and table variables and much more.


You should only attend this course if you have either attended our two-day introduction to SQL course or if you are comfortable creating queries using SQL. The course shows how to write the dialect of SQL used by Microsoft (called T-SQL), using SQL Server Management Studio as a development environment.

Course Contents

Detailed stored procedures

- Pros and cons
- Creating stored procedures
- Three ways to execute
- System stored procedures


- Declaring variables
- SET versus SELECT
- Tricks with variables
- So-called global variables

Parameters and return values

- Passing parameters
- Default values / WHERE clauses
- Output parameters
- Using RETURN

Scalar functions

- What are scalar functions?
- Some examples
- Disadvantages of scalar functions
- Three alternatives

Testing conditions

- IF / ELSE statement
- Using CASE where possible


- Syntax of WHILE
- Breaking out of a loop


- Beginning a transaction
- Committing / rolling back

Deleting and updating

- Sys.Objects
- Dropping objects

Creating tables

- Creating tables in SQL
- Primary keys and indexes
- Setting constraints
- Creating from existing data

Inserting data

- Inserting single rows
- Inserting multiple rows

Temporary tables and table variables

- Using temporary tables
- Creating table variables
- Pros and cons of each approach

Table-valued functions

- In-line table-valued functions
- Multi-statement table-valued functions
- Limitations of user-defined functions

Derived tables and CTEs

- Using derived tables
- Common Table Expressions (CTEs)
- Recursive CTEs


- The concept of a subquery
- Using ALL, ANY and IN
- Using EXISTS
- Correlated subqueries


- Syntax of fetching rows
- When not to use


- Using TRY / CATCH
- System error functions
- Custom error messages
- The obsolete @@error function


- Version differences
- The Visual Studio debugger
- The SQL Server debugger
- Debugging (breakpoints, etc.)

Dynamic SQL*

- Building up dynamic SQL
- Executing dynamic SQL
- Pros and cons


- Using the PIVOT clause
- Dynamic pivots

Please note that any items marked with a * will be covered if time allows.

Course Times

Usually 9.30am - 4.30pm. Course times will be confirmed in the joining instructions once the course has been booked.
The course either has new dates in data loading, or is only run as a dedicated or In Company course.
  • Corps Construct Logo
  • Safety & Health Logo
  • Hawks Logo
  • Know How Logo
  • Induct Ltd Logo
  • Ace Safety Logo
  • 1UPACCESS Logo
  • BAM Construction Training Logo
  • Citrus Training Logo
  • 3B Training Logo
  • Astutis Logo
  • Construction Industry Training Providers Logo
  • Health Life and Safety Logo
  • MI Construction Training Logo
  • Innov8 Training Logo
  • BSI Training Logo
  • OM Safety Training Logo
  • TotalComms Training Logo
  • SDA Safety Logo
  • Construction Skills People Logo
  • Phoenix Health and Safety Logo
  • Harris Safety Training Logo
  • First Response Training Logo
  • Alliance Learning Logo
  • ALS Safety Logo
  • KeyOstas Logo
  • Libben Health and Safety Logo
  • Global Management Academy Logo
  • Illumine Logo
  • CCAS Health and Safety Logo
  • ROSPA Logo
  • PJH Safety Training Logo
  • OMS Logo
  • Tala Training Logo
  • PRS Health and Safety Training
  • SSG Training and Consultancy Logo
  • RB Services Logo
  • Safety Training Services Logo
  • Clarkson Evans Training Logo
  • Lighthouse Training Logo
  • The Building Safety Group Logo
  • ProSafety Logo
  • Total Training Solutions Logo
  • Kentec Training Logo
  • Total Electrical Training logo
  • NTSS logo
  • Frinton Training logo
  • Envesca logo
  • The Safety Maintenance Company logo
  • APT Health and Safety logo
  • Sandwell Training Association logo
  • PC Workshops logo
  • Zero Harm Training logo
  • R2 Training logo
  • The Bradley Group logo
  • Risk Health and Safety logo
  • Wise Global Training logo
  • Total Training Company Logo
  • Sibbald Training logo
  • Total Construction Training logo
  • UTN Training logo
  • Collective Safety Solutions logo
Telephone Hotline (footer image)

Telephone Hotline

01933 233884

(Monday to Friday - 8:00am to 5:30pm).

© 2021 Book My Course Limited. All rights reserved

Home | About Us | Contact Us | FAQs | Privacy Policy | Terms & Conditions | Site Map | News / Articles | Cookie Policy