Reverse - Returns the reverse of a character expression.
REVERSE( character_expression )
For Eg.
Select CompanyName,
Reverse(CompanyName) As ReverseName,
Reverse(Left(CompanyName,5)) As ReverseFirst5Char,
Reverse (Right (CompanyName,5)) As ReverseLast5Char
From Customers
Result
In Built Funtion in T-SQL - Left and Right
Left - Returns the left part of a character string with the specified number of characters.
LEFT( character_expression , integer_expression )
Right - Returns the Right part of a character string with the specified number of characters.
RIGHT( character_expression , integer_expression )
For Eg.
Select CompanyName,
Left(CompanyName,5) As [Left],
Right(CompanyName,5) As [Right]
From Customers
Result
LEFT( character_expression , integer_expression )
Right - Returns the Right part of a character string with the specified number of characters.
RIGHT( character_expression , integer_expression )
For Eg.
Select CompanyName,
Left(CompanyName,5) As [Left],
Right(CompanyName,5) As [Right]
From Customers
Result
In Built Function in T-SQL - Upper and Lower
Upper - Returns a character expression with lowercase character data converted to uppercase.
Lower - Returns a character expression after converting uppercase character data to lowercase
For Eg.
Select CompanyName,
Lower(CompanyName) As LoweCase,
Upper(CompanyName) As UpperCase,
From Customers
Result
Lower - Returns a character expression after converting uppercase character data to lowercase
For Eg.
Select CompanyName,
Lower(CompanyName) As LoweCase,
Upper(CompanyName) As UpperCase,
From Customers
Result
SQL Query To Find Last Day of Previous Month
SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), -1)
Result
Result
Subscribe to:
Posts (Atom)