Category: Tech Tips & Tricks

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 Excel CODE Function

Sometimes you may need to convert character or text data to ASCII code value in MS Excel. There is a function called CODE in MS...

MS SQL Server PADDING Function

Sometimes you may need to pad character in left or in right in MS SQL Server. There is no direct function in MS SQL Server...

MS SQL Server REPLICATE() Function

Sometimes you may need to repeat a same string in multiple times in MS SQL Server. There is a function called REPLICATE in MS SQL...

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

MS SQL Server SPACE() Function

Sometimes you may need to add space with your desired text in MS SQL Server. There is a function called SPACEĀ in MS SQL Server by...