System
Defined Functions: These are the inbuilt functions
in SQL server. Thses functions are
provided by sql sever for different purposes. Ex. Date functions and functions
to get max value etc.
Description:
In Previous articles I have explained SQL Server: Functions in SQL
Database and their Type And Edit Update data in Grdiview with Boundfield column in asp.net(c# &
Vb.net) And Bind, Update and delete data from Gridview in Asp.Net using C# and VB.net
And Implementation of Page Index or Paging in Gridview Control In asp.net (c#
& Vb.net) .
There
are two type of system defined function:
1.
Scalar Functions: These functions accept input
parameter and return single value.
Some Useful Scalar Functions In SQL SERVER
|
|
Function
|
Description
|
rand(5)
|
Generate random no of 5
characters
|
upper('test')
|
Convert string to Upper case
i.e. TEST
|
lower(‘TEST’)
|
Convert string to lower case
i.e. test
|
ltrim(' test)
|
Remove spaces from left side of
string
|
abs(-5.6)
|
Return absolute no of given
input i.e. 5.6
|
2. Aggregate Functions: These functions accept collection of values as input and generate single value result.
Some
Useful Aggregate Functions In SQL SERVER
|
|
Function
|
Description
|
avg()
|
Returns
Average value from collection of values
|
Min()
|
Returns
minimum value from collection of
values
|
max()
|
Returns
maximum value from collection of values
|
count()
|
Returns
count of collection of values
|