0% found this document useful (0 votes)
2 views1 page

In Built Functions in SQL Server

The document outlines various functions used in programming, categorized into string, numeric, date and time, conversion, aggregate, logical, system, mathematical, string manipulation, NULL-related, XML, and full-text search functions. Each category includes specific functions along with their descriptions, such as LEN for string length and SUM for summing column values. These functions are essential for data manipulation and querying in databases.

Uploaded by

koushikkotireddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

In Built Functions in SQL Server

The document outlines various functions used in programming, categorized into string, numeric, date and time, conversion, aggregate, logical, system, mathematical, string manipulation, NULL-related, XML, and full-text search functions. Each category includes specific functions along with their descriptions, such as LEN for string length and SUM for summing column values. These functions are essential for data manipulation and querying in databases.

Uploaded by

koushikkotireddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

String Functions:
LEN(string): Returns the number of characters in a string.
LEFT(string, length): Returns the left part of a string.
RIGHT(string, length): Returns the right part of a string.
CHARINDEX(substring, string): Returns the starting position of a substring in a
string.
2. Numeric Functions:
ABS(number): Returns the absolute value of a number.
ROUND(number, decimal_places): Rounds a number to a specified number of decimal
places.
CEILING(number): Rounds a number up to the nearest integer.
FLOOR(number): Rounds a number down to the nearest integer.
3. Date and Time Functions:
GETDATE(): Returns the current date and time.
DATEDIFF(datepart, startdate, enddate): Returns the difference between two dates.
DATEADD(datepart, number, date): Adds a specified number to a datepart of a date.
4. Conversion Functions:
CONVERT(datatype, expression, style): Converts a value (or expression) of one data
type to another.
CAST(expression AS datatype): Converts an expression to a specified data type.
5. Aggregate Functions:
SUM(column): Returns the sum of values in a column.
AVG(column): Returns the average of values in a column.
MIN(column): Returns the minimum value in a column.
MAX(column): Returns the maximum value in a column.
COUNT(column): Returns the number of rows in a result set.
6. Logical Functions:
CASE: Performs conditional logic in a query.
7. System Functions:
USER_NAME(): Returns the user name of the current user.
CURRENT_TIMESTAMP: Returns the current date and time in the session time zone.
8. Mathematical Functions:
PI(): Returns the value of PI.
SQRT(number): Returns the square root of a number.
10. String Manipulation Functions:
LOWER(string): Converts all characters in a string to lowercase.
UPPER(string): Converts all characters in a string to uppercase.
LTRIM(string): Removes leading spaces from a string.
RTRIM(string): Removes trailing spaces from a string.
SUBSTRING(string, start, length): Returns a substring from a string.
11. NULL-related Functions:
ISNULL(expression, value_if_null): Replaces NULL with the specified value.
COALESCE(expression1, expression2, ...): Returns the first non-NULL expression in
the list.
12. XML Functions:
XML PATH: Used with FOR XML to format query results as XML.
XML VALUE: Extracts a value from an XML column.
13. Full-Text Search Functions:
CONTAINS(column, 'search_text'): Determines whether a column contains a specified
set of words.
FREETEXT(column, 'search_text'): Determines whether a column contains a specified
free-text expression.

You might also like