Using Cursors to Update Records in SQL Server
In SQL Server, cursors provide a powerful but often misused way to process records one at a time. While it’s generally recommended to use set-based...
Dynamic Table Name Usage in MS SQL Server: A Step-by-Step Guide
Introduction: In the world of SQL Server, the ability to dynamically use table names adds a layer of flexibility and efficiency to your queries. Imagine...
Pivoting in MS SQL Server
SELECT * FROM ( SELECT p.product_name, g.tx_id, g.transmonth FROM [DataAnalytics].[dbo].[tbla_hst_gross_add_policy] g INNER JOIN [DataAnalytics].[dbo].[tbld_product] p ON g.product_code = p.product_code and transmonth>='202101' ) t PIVOT (...
MS SQL Server PATINDEX() Function
Sometimes you may need to delete specific characters in one string by inserting another specific length of string in MS SQL Server. There is a...
How to Change Data Type of a Column in MS SQL Server
Sometimes you may need to change data type of a column in a table in MS SQL Server. To do this, you need to use...