Audit Trail & System-Versioned Temporal Table

What is a system-versioned temporal table? An audit trail is a chronological record of all database transactions, including insertions, updates, and deletions. It captures both the old and new values of modified data, as well as metadata such as the user or application responsible for the change, the date and time of the change, and…

How to Solve xp_cmdshell for Non-System Users

Sometimes we use xp_cmdshell in T-SQL to run console applications on a remote server. “xp_cmdshell” is an extended stored procedure provided by Microsoft and stored in the master database. This procedure allows you to issue operating system commands directly to the Windows command shell via T-SQL code. If needed the output of these commands will…

Regular Expression in T-SQL

Regular Expressions can be very useful to the Database programmer, particularly for data validation, data feeds and data transformations.  In C#.NET, Regex.Replace Method replaces all occurrences of a character pattern defined by a regular expression with a specified replacement character string. We can do the same steps in T-SQL (2005/2008). Use the Ole Automation Procedures…