SQL Server System Functions

SQL Server System Functions are built-in functions provided by Microsoft SQL Server that perform various tasks related to system information, data type conversion, string manipulation, date and time operations, mathematical calculations, and more. These functions are available for use within SQL queries and can help simplify and enhance the functionality of your database applications. Here are some commonly used SQL Server System Functions:

FunctionDescription
CASTCast a value of one type to another
CONVERTConvert a value of one type to another
CHOOSEReturn one of the two values based on the result of the first argument.
ISNULLReplace NULL with a specified value
ISNUMERICCheck if an expression is a valid numeric type
IIFAdd if-else logic to a query
TRY_CASTCast a value of one type to another and return NULL if the cast fails
TRY_CONVERTConvert a value of one type to another and return the value to be translated into the specified type.  It returns NULL if the cast fails
TRY_PARSEConvert a string to a date/time or a number and return NULL if the conversion fails.

Leave a Reply

Your email address will not be published. Required fields are marked *