SQL Server System-Related Functions
System-Related Functions
In this article, we will examine built-in functions that have to do with getting information about SQL Server internals, configuration, global variables, and metadata for system and user databases. Information contained in this article should be of interest to developers as well as database administrators. We won't discuss every supported function; I'll show you only the ones I have found most useful.
System Functions
Please be forewarned that the boundary between system, system statistical, configuration, and metadata functions is rather loose. SQL Server online documentation, as well as the Object Browser (available within Query Analyzer), group the functions into these categories. Although you might assume that both the DB_NAME() and APP_NAME() functions qualify for the same category, the former happens to be a metadata function and the latter is a system function. In this and following articles in this series, we will follow the grouping provided in Query Analyzer.
Another nuance to be aware of is that built-in functions have a picky syntax. They might require parentheses even if they don't accept any parameters.