How to sort comments with nested replies in SQL Server?

How to sort comments with nested replies in SQL Server?

Do you need to sort comments with nested replies in SQL Server? Well this can be easily done by combining the same table using the UNION ALL join to populate the comments content. There is a trick to used to sort the comments which use the combination of a record ID field with the row number index.
How to check if a table exists in SQL server?

How to check if a table exists in SQL server?

Before running an SQL script to create a table dynamically, it would be a good step if you perform a checking if a table already exists. If it does, you may want to skip creating the table otherwise you will get an error exception.
How to add new column to table in SQL Server?

How to add new column to table in SQL Server?

In this tutorial, you will learn how to add new columns to table in SQL Server. Let's say we have a table called table_product and we want to add two columns named ProductCode and Description.
How to use if condition in SQL Server?

How to use if condition in SQL Server?

You might come with a scenario where you need to use if condition when there are two possible cases occur. For example, when you develop a program or website, you want to do some sort of scheduling that can synchronize your current records with the existing data.