Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Functions (Built-In)

Functions (Built-In)

Example: You need the average price of all the products in the products table. The AVG built-in function can be used in a SELECT statement to calculate and retrieve the average price. SQL Server provides a rich set of built-in functions in several different categories. Use existing built-in functions instead of creating your own.

  • Can be accessed in a SELECT statement or a VIEW.

  • Different functions accept varying input.

  • Output can be scalar (single value) or a result set that can be used as a derived table.

  • BOL topic “Functions (Transact-SQL)” has a category listing of built-in functions. Two examples are:

    • String functions can be used to manipulate character data such as LTRIM to remove leading spaces.

    • Date functions can be used to retrieve or manipulate dates such as GetDate() to get the current date.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial