Our Recommendation for You Search your Query, You can find easily. for example search by book name or course name or any other which is related to your education

label name

PHP

SQL Server Functions

SQL Server Functions


SQL Server has many built-in functions.
This reference contains the string, numeric, date, conversion, and advanced functions in SQL Server.

SQL Server String Functions

FunctionDescription
ASCIIReturns the number code that represents the specific character
CHARReturns the ASCII character based on the number code
CHARINDEXReturns the location of a substring in a string
CONCATConcatenates two or more strings together
Concat with +Concatenates two or more strings together
DATALENGTHReturns the length of an expression (in bytes)
LEFTExtracts a substring from a string (starting from left)
LENReturns the length of the specified string
LOWERConverts a string to lower-case
LTRIMRemoves leading spaces from a string
NCHARReturns the Unicode character based on the number code
PATINDEXReturns the location of a pattern in a string
REPLACEReplaces a sequence of characters in a string with another set of characters
RIGHTExtracts a substring from a string (starting from right)
RTRIMRemoves trailing spaces from a string
SPACEReturns a string with a specified number of spaces
STRReturns a string representation of a number
STUFFDeletes a sequence of characters from a string and then inserts another sequence of characters into the string, starting at a specified position
SUBSTRINGExtracts a substring from a string
UPPERConverts a string to upper-case

SQL Server Numeric Functions

FunctionDescription
ABSReturns the absolute value of a number
AVGReturns the average value of an expression
CEILINGReturns the smallest integer value that is greater than or equal to a number
COUNTReturns the count of an expression
FLOORReturns the largest integer value that is equal to or less than a number
MAXReturns the maximum value of an expression
MINReturns the minimum value of an expression
RANDReturns a random number or a random number within a range
ROUNDReturns a number rounded to a certain number of decimal places
SIGNReturns a value indicating the sign of a number
SUMReturns the summed value of an expression

SQL Server Date Functions

FunctionDescription
CURRENT_TIMESTAMPReturns the current date and time
DATEADDReturns a date after a certain time/date interval has been added
DATEDIFFReturns the difference between two date values, based on the interval specified
DATENAMEReturns a specified part of a given date, as a string value
DATEPARTReturns a specified part of a given date, as an integer value
DAYReturns the day of the month (from 1 to 31) for a given date
GETDATEReturns the current date and time
GETUTCDATEReturns the current UTC date and time
MONTHReturns the month (from 1 to 12) for a given date
YEARReturns the year (as a four-digit number) for a given date

SQL Server Conversion Functions

FunctionDescription
CASTConverts an expression from one data type to another
CONVERTConverts an expression from one data type to another

SQL Server Advanced Functions

FunctionDescription
COALESCEReturns the first non-null expression in a list
CURRENT_USERReturns the name of the current user in the SQL Server database
ISDATEReturns 1 if the expression is a valid date, otherwise 0
ISNULLLets you return an alternative value when an expression is NULL
ISNUMERICReturns 1 if the expression is a valid number, otherwise 0
NULLIFCompares two expressions
SESSION_USERReturns the user name of the current session in the SQL Server database
SESSIONPROPERTYReturns the setting for a specified option of a session
SYSTEM_USERReturns the login name information for the current user in the SQL Server database
USER_NAMEReturns the user name in the SQL Server database