My Favorite New T-SQL in SQL Server 2025
Description
This session is a dive into everything new that appears in SQL Server 2025 and are already available in Azure SQL Database.
Looking to use the new Regex functions? There is a surprising upgrade snuck in there for STRING_SPLIT().
Is PRODUCT() really useful? Yes. Yes it is!
What is fuzzy string matching all about?
JSON support is finally here!
There's more to be had, waiting for you right here!
Key Takeaways
- Dynamic SQL: Applications, Performance, and Security, 2nd Edition
- Analytics Optimization with Columnstore Indexes in SQL Server
- 2nd edition forthcoming
- Expert Performance Indexing in SQL Server, 4th Edition
- Published in Expert T-SQL Functions in SQL Server, 3rd Edition
- SQL Saturday New York City
- Capital Area SQL Server User Group
My Notes
Action Items
- [ ]
Resources & Links
Slides
My Favorite New
T-SQL in
SQL Server 2025
Edward Pollack
Microsoft Data Platform MVP
Data Architect
Transfinder
Ed Pollack
Microsoft Data Platform MVP
Published author of:
• Dynamic SQL: Applications, Performance, and Security, 2nd Edition
• Analytics Optimization with Columnstore Indexes in SQL Server
• 2nd edition forthcoming
• Expert Performance Indexing in SQL Server, 4th Edition
• Published in Expert T-SQL Functions in SQL Server, 3rd Edition
Author on Simple Talk.
Organizes:
• Day of Data Albany
• SQL Saturday New York City
• Capital Area SQL Server User Group
Speaker at many data events
A blue and white sign
Description automatically generated with low confidence
A picture containing graphical user interface
Description automatically generated
A grey and orange logo
Description automatically generated with low confidence
Agenda
• All about new features, versions, and compatibility levels
• New T-SQL in SQL Server 2025 & Azure SQL Database
• Many demos!
• Conclusion
Note: All demos use SQL Server 2025 CU2 (17.0.1000.7)
New Features!?
• Every major versions of SQL Server contains new T-SQL, changes,
and enhancements. Some minor releases, too!
• Compatibility level
• Guides behavior/performance
• Does not impact features, unless they tie to performance
• Helps facilitate smooth upgrades
• Guaranteed with SQL Server 2016+
• Some features are Azure-only or on-prem-only
DEMO: Compatibility levels
PRODUCT()
• Aggregate function that returns the product of a set of values
• Works like SUM, MIN, MAX, COUNT, AVG, etc…
• Great for:
• Statistics
• Metrics
• Financial calculations
• Code simplification
DEMO: PRODUCT()
Regular Expressions (REGEX)
• Provides superior string searching/matching than existing LIKE/NOT
LIKE operators can.
• Native support was never available in SQL Server - until now!
• Uses any regex pattern you can dream up.
• Some functions require compatibility level 170
• Will be specified when this is relevant.
• Think about the (scary) code you previously used for these
applications!!!
DEMO: Native Regex in SQL Server 2025
Resource Governor for TempDB Space
• Can now manage TempDB data space with Resource Governor (!)
• Log space can be managed via Accelerated Database Recovery on TempDB
• Can assign maximum data used by workload group
• Will cancel queries that would violate TempDB data space limits
Vector Functions
• Adds the vector data type and many associated functions.
• Used for mathematical and statistical analysis.
• Easily integrated into AI-generated vector embeddings.
• Allows for analysis/comparison of text using any available LLM.
DEMO: The vector data type and vector functions
JSON Functions
• JSON_OBJECTAGG()
• JSON_ARRAYAGG()
• Provide the ability to create JSON from SQL data (scalar,
values, tables…)
DEMO: Two new JSON functions
String Similarity Functions
• EDIT_DISTANCE()
• EDIT_DISTANCE_SIMILARITY ()
• JARO_WINKLER_DISTANCE ()
• JARO_WINKLER_SIMILARITY ()
• Calculate similarities/differences between strings.
• Deterministic
• Well-documented algorithms
DEMO: String similarity functions
But Wait – There’s More!
• SUBSTRING(): The length parameter is now optional and will
default to the remainder of the string. Simplifies code!
• DATEADD(): Accepts a BIGINT as the number to add.
• CURRENT_DATE: Returns the current date as a DATE type.
• BASE64ENCODE: Converts a VARBINARY to VARCHAR
• BASE64DECODE: Converts a VARCHAR to VARBINARY
DEMO: Changes to existing syntax
Conclusion
• SQL Server 2025 has plenty of new T-SQL syntax.
• New features:
• Add new functionality
• Improve performance/cost
• Simplify your code
• Upgrade…test…enjoy!
• More on the way…
Questions? Thank You!
•Find me here:
• Ed Pollack | LinkedIn
• Edward Pollack | Most Valuable Professionals
• https://sessionize.com/edward-pollack/
•Find my content here:
• EdwardPollack (Ed Pollack) (github.com)
• Edward Pollack, Author at Simple Talk (red-gate.com)
• Ed Pollack, Author at SQL Shack - articles about database
auditing, server performance, data recovery, and more
Sound off.
The mic is all yours.
Influence the product roadmap.
Join the Fabric User Panel
Join the SQL User Panel
Share your feedback directly with our
Fabric product group and researchers.
Influence our SQL roadmap and ensure
it meets your real-life needs
https://aka.ms/JoinFabricUserPanel
https://aka.ms/JoinSQLUserPanel