Functions in SQL Server

Functions:

A function is mainly used in the case where it must return a value. A function can be created and called in SQL Queries. There are some pre-defined functions available in MS SQL server, they are

• AVG() - Returns the average value
• COUNT() - Returns the number of rows
• FIRST() - Returns the first value
• LAST() - Returns the last value
• MAX() - Returns the largest value
• MIN() - Returns the smallest value
• SUM() - Returns the sum
• UCASE() - Converts a field to upper case
• LCASE() - Converts a field to lower case
• MID() - Extract characters from a text field
• LEN() - Returns the length of a text field
• ROUND() - Rounds a numeric field to the number of decimals specified
• NOW() - Returns the current system date and time
• FORMAT() - Formats how a field is to be displayed

Types of Functions:

=> User Defined Functions
=> Split function

0 comments:

Post a Comment

Blogger news