O'Reilly logo

Beginning Transact-SQL with SQL Server 2000 and 2005 by Dan Wood, Paul Turley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6

SQL Functions

Now that you understand how to formulate SQL queries and return result sets, you need to do something useful with this data. Once you have successfully retrieved values from tables, it's very common to further manipulate values to provide useful and meaningful results. This may involve the following:

  • Performing calculations and mathematical operations
  • Conversion
  • Parsing
  • Combining values
  • Aggregation

The purpose of this chapter is to help you learn the mechanics of using functions of all kinds. It introduces you to some of the more common value manipulation functions and some less-common functions to give a sample of these powerful capabilities. You'll also take a look at some new functionality offered in SQL Server 2005.

At the end of the book, you'll find a reference for all of the system-supplied functions and the syntax needed to use them. Additionally, subsequent chapters contain more detailed information about specific groups of functions. For example, Chapter 7 discusses specific uses for aggregate functions in more advanced SQL queries, and Chapter 11 shows you how to use functions to support full-text index searches.

Transact-SQL functions are grouped into the categories described in the following table.

Function Category Purpose
Aggregation Aggregate functions return a scalar value representing an aggregation over a range of values, applying a specific aggregate selection or summary.
Configuration Variables Return information about the SQL Server ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required