PowerShell: Manipulating & Copying File Permissions In Windows

The Mystery Recently a folder within a SMB share on the Windows Server (network share) displayed only certain files but not others for a certain user. For an administrator, the share displayed all the files in the folder. Obviously, there is some difference in the permissions, but what? Examining the difference between the files (using … Continue reading PowerShell: Manipulating & Copying File Permissions In Windows

Advertisement

PowerShell: Find & Replace SQL Server Stored Procedure/View/UDF/Trigger Code En Masse Based On Custom Criteria

Update April 19, 2019: Thanks to Tim (in comments), the updated script can also do find/replace in not just stored procedures but also views, UDF's and triggers. Today, a need came-up where a bunch of stored procedures had to be altered based on certain criteria. Easy way: Obviously, the easiest way would be to script … Continue reading PowerShell: Find & Replace SQL Server Stored Procedure/View/UDF/Trigger Code En Masse Based On Custom Criteria

PowerShell – Case-insensitive String Replacement

The problem: Replace "a" with "b" case-insensitively You have a simple string and you want to replace all "a" with "b" in a case-insensitive manner. First attempt (fail): PS C:\Windows\system32> [string] $someString = 'aAaAaAaA' $SomeString.Replace('a', 'b') #Result bAbAbAbAbA What happened? The [string].Replace() method is case-sensitive Second attempt (looks like it works but not quite): PS … Continue reading PowerShell – Case-insensitive String Replacement

Oracle Tip – COPY Command – When You Don’t Have DataPump

This is an old post that I am re-cycling. The recommended method to copy data around is by using DataPump. However, if you are on an older version of Oracle, COPY command is an easy way to copy data from one database to another or even within the same database. There are countless situations where … Continue reading Oracle Tip – COPY Command – When You Don’t Have DataPump

SQL Server Loops – Alternative to OPEN, FETCH & CLOSE loop using ROW_NUMBER in TSQL

Have I every said that I hate don't like cursor based logic? This time, I am going to show how to replace cursor logic in your TSQL with loops. Caution: RBAR is bad! While row-by-row processing is generally bad both in Oracle and SQL Server, there are instances where it is best to simply loop … Continue reading SQL Server Loops – Alternative to OPEN, FETCH & CLOSE loop using ROW_NUMBER in TSQL