Tag: SQL

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...