How To Write SQL Server Queries Correctly: Views vs Inline Table Valued Functions

Опубликовано: 16 Июль 2026
на канале: Erik Darling (Erik Darling Data)
1,349
95

In this video, I delve into the world of views and inline table-valued functions in SQL Server, exploring how these database objects can be both a blessing and a curse depending on their usage. I discuss common pitfalls that arise when people misuse views, leading to performance issues due to excessive nesting and overly complex queries. Additionally, I highlight the advantages of inline table-valued functions, particularly their ability to accept parameters, which can help push predicates further into queries for better optimization. The video also covers a specific issue with views inside stored procedures versus using literal values directly, and how Microsoft addressed this problem in later SQL Server versions through query optimizer hot fixes. By sharing practical examples and solutions, I aim to provide viewers with insights on when and how to effectively use these database objects to enhance their SQL skills.

CHAPTERS

00:00:00 - Introduction to Views and Inline Table Valued Functions
00:03:15 - Simple Query with Literal Value
00:06:48 - Parameterized Query without Fixes
00:12:19 - Using Compatibility Level Hint for Better Performance
00:17:16 - Inline Table Valued Function Example
00:21:04 - Summary and Next Video

━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 TRAINING & COURSES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Get AI-Ready With Erik
https://training.erikdarling.com/get-...

SQL Server Performance Engineering Course
https://training.erikdarling.com/sql-...

Learn T-SQL with Erik
https://training.erikdarling.com/lear...

Everything Bundle:
https://training.erikdarling.com/?cou...

━━━━━━━━━━━━━━━━━━━━━━━━━━
🛠️ CONSULTING & SERVICES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Need SQL Server performance help?
https://training.erikdarling.com/sqlc...

━━━━━━━━━━━━━━━━━━━━━━━━━━
💬 CONNECT
━━━━━━━━━━━━━━━━━━━━━━━━━━
Ask questions at Office Hours
https://erikdarling.com/officehours/

Become a channel member
   / @erikdarlingdata  
━━━━━━━━━━━━━━━━━━━━━━━━━━