Documentation Index
Fetch the complete documentation index at: https://rajanand.org/llms.txt
Use this file to discover all available pages before exploring further.
How to concatenate values from previous row to current row in SQL?
Answer:
How to check the database recovery progress in SQL Server?

How to identify similarly pronounced words in SQL server?
There are two functions in SQL Server that are used to identify whether the two strings are pronounced similarly or not. They are-
SOUNDEX()- This function takes a string as parameter and returns a four-character code. This code is called as Soundex. When this code is calculated it basically ignores the vowels (A, E, I, O, U), H, W, and Y unless they are the first letter of the string. -
DIFFERENCE()- This function takes two strings as parameter and returns a integer value from 1 to 4. This function internally calculates the SOUNDEX code for each of the string and find the difference between the twoSOUNDEXcode.

DIFFERENCE function
| Output | Meaning |
|---|---|
| 1 | Not similar |
| 2 | Very less similar |
| 3 | Some what similar |
| 4 | Exact match/ Mostly similar |
- What happens to the records inserted into a table variable, if the transaction rollback?
- How to sort result set in custom order in SQL?
- How to concatenate values from previous row to current row in SQL?
How to concatenate multiple rows into a single string in SQL?
Write a SQL query to concatenate multiple rows into a single string?

-
STUFF function with XML path
stuff function.
-
Substring function with XML path
substring function to select all the text except the leading comma. We have given approximate length as 10000 and this can be modified based on the scenario.
-
STRING_AGG function
string_agg function was introduced in SQL Server 2017. It concatenates the values of string and places separator(comma in our case) values between them. The separator isn’t added at the end of string. If there are NULL, then it will be ignored and separator will not be added for that.
-
COALESCE function

How to get any object’s definition in SQL Server?
You can use the below query to get the definition of any object in SQL Server. You can replace the object type in the query to get the definition of the object.
How to find a SQL Server agent jobs last executed and next scheduled date time?
You can execute the below query to get the list of SQL Server agents jobs and when it was last executed and time it took to complete the job and when it is scheduled to run next.
List of all foreign keys and referenced tables and columns

List out all the indexes defined on a table and column details.

How to replace the first instance of the string in T-SQL?
You can use the combination ofstuff, charindex and len function to replace the first occurrence of the string.

How to get all the computed columns in a database in SQL Server?

How to search for a table or column in all the databases in a server
To search for a table across databases in a server
How to check database restore history and backup file used for restore in SQL Server?

How to split a string into a list of values in SQL?
I have created a function to split a string based on the delimiter value and return the result as a single column of values in a table.
How to search for a list of words contains in a string column?
To search whether the list of words contains in a column, you can implement it using a series of conditions withLIKE and OR operators. But to search for additional word, you need to add another condition.
dbo.fn_contains that search for the words in a string column. This function uses another function dbo.fn_string_to_list which converts a string to a list of values.
