Necessity is the mother of new PowerShell code :-)! Today, I had to unmask all the columns I had helped mask using Dynamic Data Masking. This simple post assumes that you are a privileged user with the ability to drop "Column Masking"! Identify Masked Columns The SQL to identify all masked columns is pretty simple … Continue reading PowerShell & SQL Server: Unmask All Masked Columns (Dynamic Data Masking) In Database
Category: Dynamic SQL
SQL Server: Dynamically Calculate Delta Values For Numeric And Date Columns From DMV’s Or Any Table
DMV's are very useful. In fact, they are like glass windows that lets you look at a running engine. There are lots of them and they give us lots of numbers but Most are cumulative in nature! i.e., the numbers keep on increasing and never decrease. A variation of above like space usage where the … Continue reading SQL Server: Dynamically Calculate Delta Values For Numeric And Date Columns From DMV’s Or Any Table
SQL Server – Dynamically PIVOT ANY Column On ANY Table in ANY Database For ANY Aggregation With ANY Condition
SOURCE CODE ATTRIBUTION: Before I proceed, I want to give credit to the original procedure by sfrejofsky based on which I created this procedure (mostly improvements). The source of this procedure is https://stackoverflow.com/questions/10404348/sql-server-dynamic-pivot-query I had a need to do dynamic PIVOTing for one of my projects and instead of reinventing the wheel, I used the … Continue reading SQL Server – Dynamically PIVOT ANY Column On ANY Table in ANY Database For ANY Aggregation With ANY Condition
SQL Server: Using Data From Another Instance To Drive Logic In Current Instance (Using Linked Server)
Data is in another DB/Instance - but logic needs to be in this DB/instance Your logic in the current database/instance sometimes is driven by data in a completely separate SQL Server instance. People do this using different methods Use LinkedServer to bring over and join data Use SSIS or another mechanism to copy the data … Continue reading SQL Server: Using Data From Another Instance To Drive Logic In Current Instance (Using Linked Server)
SQL Server Dynamic SQL – Use Bind Variables
Dynamic SQL – SQL that is constructed by putting together strings to form executable code that gets parsed for the first time by the compiler at run-time. Justification for Dynamic SQL? There should be relatively few instances where dynamic SQL is the only option. Generally, regular SQL whose syntax can be checked by the compiler … Continue reading SQL Server Dynamic SQL – Use Bind Variables