Back to results for “Fundamentals”
SQL Server › T-SQL Fundamentals & Syntax

What is T-SQL, and how does it relate to standard SQL?

Beginner

Answer

T-SQL, short for Transact-SQL, is Microsoft's extension of standard SQL used specifically in SQL Server, adding extra features beyond the standard SQL language, such as procedural programming constructs like variables, loops, and error handling, that let you write more powerful logic directly within the database.
DECLARE @Count INT;
SET @Count = 10;
IF @Count > 5
  PRINT 'Count is greater than five';
Real-world example A developer familiar with standard SQL learns T-SQL's additional procedural features, like variables and IF statements, to build more sophisticated logic directly within SQL Server stored procedures.

Common follow-ups: What specific features does T-SQL add beyond standard ANSI SQL?;Are T-SQL scripts portable to other database systems like MySQL or PostgreSQL?