Category: Miscellaneous
-
Rename Columns in SQL Server
SQL Server allows us to change the column whenever we need. We will rename the table columns when the column name is non-meaningful or does not fulfill the purpose of its creation. It must ensure that we have ALTER permission on the object before changing the column’s name. Limitations and Restrictions SQL Server has some…
-
SQL Server Row Number
Row number is the most common ranking function used in SQL Server. The ROW_NUMBER() function generates a sequential number for each row within a partition in the resultant output. In each partition, the first-row number begins with 1. We must always use the ORDER BY clause to ensure that the numbers are assigned in the proper sequence. The values returned by…
-
Index in SQL Server
An index is one of the important paths to make the performance of SQL Server database high. It makes the querying process fast by providing easy access to rows in data tables, similar to how a book’s index will quickly locate information inside that book. If we do not have an index, then it is very tough to…
-
Cursor in SQL Server
A cursor in SQL Server is a database object that allows us to retrieve each row at a time and manipulate its data. A cursor is nothing more than a pointer to a row. It’s always used in conjunction with a SELECT statement. It is usually a collection of SQL logic that loops through a predetermined number…
-
Common Table Expression (CTE) in SQL Server
We will use the SQL Server’s Common Table Expressions or CTEs to make complex joins and subqueries easier. It also provides a way to query hierarchical data, such as an organizational hierarchy. This article gives a complete overview of CTE, types of CTE, advantages, disadvantages, and how to use them in SQL Server. What is…
-
SQL Server Substring
SUBSTRING is a SQL Server built-in function that allows us to extract a specific substring from any given string set based on our requirements. Database developers widely use this function in queries to extract any number of substrings from an input string. Substring extracts a string of a specified length from an input string beginning at a…