Booking Enquiry

Advanced SQL

£800 per delegate

Duration: 2 days

Trainer: S047OW


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.

Your Enquiry

Please enter your enquiry details below and leave the rest to us. Need different dates or venue? No problem! Please remember to include:
- Preferred dates
- Preferred location(s)

Your Details

What happens next?
Once you have clicked above and sent us your enquiry, our team of advisors will then review your specific needs and email the details that best suit you. We may need to contact you to clarify requirements prior to processing the enquiry.
  • 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 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
  • Essential Site Plant 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
  • Induct Training 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
  • PC Workshops logo
  • Zero Harm Training logo
  • R2 Training logo
  • Risk Health and Safety logo
  • Wise Global Training logo
  • Know How Logo
  • Sibbald Training logo
  • Total Construction Training logo
  • UTN Training logo
  • Essential Site Skills
  • PQMS Training logo
  • Collective Safety Solutions logo
  • C&C Training Logo
  • Purple Cow Logo
  • Bradley Group New Logo
  • Construction Training Academy UK
  • IMC Pro Solutions Logo
  • CISTC Logo
  • Dorset Health and Safety Logo
  • Hine Training Logo
  • Fencing and Construction Logo
  • Pragmatic Consulting Logo
  • Common Sense Logo
  • South West Training
  • Hunter Training Solutions
  • Behavioural Safety
  • Randr Training Services
  • Safety & Training Logo
  • Talking Safety Logo
  • Total Protection Logo
  • A Plus Safety Logo
  • Catersafe 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