String, Conversion, NULL Fuctions in SQL Server with Examples | How we can apply at Real-Time

preview_player
Показать описание
Functions:
A string function is a function that takes a string value as an input regardless of the data type of the returned value. In SQL Server, there are many built-in string functions that can be used by developers.

1. #STRINGFunctions
2. #ConversionFunctions
3. #NULLFunctions

#ASCII : It returns numeric value of given character
Syntax:
ASCII( character )
#CHAR() : IT returns the character for passes integer.
Syntax:
CHAR(Integer)
#CHARINDEX():It returns the location of a substring in a string.
Syntax:
CHARINDEX( substring, string, start position )
#CONCAT() Join two or more strings into one string
Syntax:
CONCAT( string1, string2, ... string_n )
#DATALENGTH() The DATALENGTH function returns the length of an expression, in bytes.
The DATALENGTH function counts both trailing spaces and preceding spaces
when calculating the length of the expression
Syntax:
#DATALENGTH( expression )
#LEN() Return the Number of Characters
LEN function which does not include the trailing spaces in the length calculation.
Syntax:
LEN( string )
#LEFT() It extracts a number of characters from a string starting from left.
Syntax:
LEFT( string, number_of_characters )
#RIGHT() It extracts a number of characters from a string starting from Right.
Syntax:
RIGHT( string, number_of_characters )
#LTRIM() IT removes all space characters from the left-hand side of a string.
Syntax:
LTRIM(String)
#RTRIM() IT removes all space characters from the Right-hand side of a string.
Syntax:
RTRIM(String)
#UPPER() Return Value as UPPER Case Characters
Syntax:
UPPER(String)
#LOWER() Return Value as LOWER Case Characters
Syntax:
LOWER(String)
#PATINDEX()
It returns the position of a pattern in a string.
If the pattern is not found, this function returns 0.
Syntax:
PATINDEX( '%pattern%', string )
#REPLACE(): Replcae one set of characters with another
Syntax:
REPLACE( string, string_to_replace, replacement_string )
#STUFF(): STUFF function to insert one string within another string
Syntax:
STUFF( source_string, start, length, add_string )
#SUBSTRING(): SUBSTRING function returns a specified portion of a string.
Syntax:
SUBSTRING( string, start_position, length )
#REVERSE(): Flip the value END to END
Syntax:
REVERSE(Expression)
#ISNULL(): The ISNULL function is used to replace NULL value with another value
Syntax:
ISNULL( expression, alternative_value )
#COALESCE(): The COALESCE function returns the first non-null expression in the list. If all expressions evaluate to null,
then the COALESCE function will return null.
Synatx:
COALESCE( expression1, expression2, ... expression_n )

#CONVERSION FUNCTIONS:
CAST(): The CAST function in SQL converts data from one data type to another.
Syntax:
CAST( expression AS Datatype(length))
#COVERT(): Converts Data from one Data type to another Data type.
Syntax:
CONVERT (Data type (length), expression ,DateFormatstyleNumber)

SQL Server String Functions - CharIndex,PatIndex
Convert function in SQL | SQL convert, cast functions
SQL Conversion Functions TO_CHAR, TO_DATE, TO_NUMBER with example
Conversion Functions in SQL Server 2012
Different ways to replace NULL in sql server
SQL General Functions NVL , NVL2, NULLIF and COALESCE
sql server tutorial for beginners |microsoft sql server tutorial for beginners
sql server tutorial for experienced | sql operators and their precedence
ms sql management studio tutorial | sql server basics
microsoft sql server tutorial youtube | microsoft sql server tutorial stored procedure
How to Use Datetime in SQL - SQL Training Tutorials
Рекомендации по теме