T-SQL 101: 29 Calling user-defined functions in SQL Server T-SQL queries
Important concepts in any development are reusing code, and abstraction. Look at the first WHERE clause here:
I’ve asked SQL Server to return rows where the CreditRatingID is the one that has the maximum rating. I might not know how to find the maximum rating but if there is code that finds it for me (i.e. dbo.GetMaximumRating()), I don’t need to know that.
This is an example of a function that retrieves a value, and then I can use the value in my own query, without having to copy all the code that’s needed, and without even having to know how it works.
2019-08-05