SQL Server – Running A Script Or SQL On Multiple Instances/Databases With PowerShell – Level 100

Today, I received a really simple request. There was an UPDATE statement that had to be run on quite a few databases in multiple instances.  This was for a vendor software we use and the statement was sent to me by a Helpdesk professional who manages the product. You need to have the SQLPS (older) … Continue reading SQL Server – Running A Script Or SQL On Multiple Instances/Databases With PowerShell – Level 100

Advertisements

Hard-coding Values In SQL Code – Please Don’t

What is hard-coding? Wikipedia defines it as below Hard coding (also, hard-coding or hardcoding) refers to the software development practice of embedding what may, perhaps only in retrospect, be regarded as input or configuration data directly into the source code of a program or other executable object, or fixed formatting of the data, instead of … Continue reading Hard-coding Values In SQL Code – Please Don’t

Oracle – Simplify Your Joins – Using “USING” In JOIN Clause?!

Same SQL written in 3 different ways “There are a thousand ways to skin a cat” or so they say. Let us look at just three ways of writing the same SQL and build the case for using the USING clause. The query below is to get the current Oracle session’s effective “parallel” related parameter … Continue reading Oracle – Simplify Your Joins – Using “USING” In JOIN Clause?!

Oracle Tip – EXECUTE IMMEDIATE With Bind Variable Input In Dynamic SQL

Caution: If there is no need to use a dynamic SQL, you should always use regular non-dynamic SQL. This is a bad usage of dynamic SQL and I am only doing so to illustrate the use of bind variables. The task: Again, I just wanted to provide a basic example that shows the usage of EXECUTE … Continue reading Oracle Tip – EXECUTE IMMEDIATE With Bind Variable Input In Dynamic SQL

Oracle – Find Hard-coded Dates In PL/SQL Code Using Regular Expressions

Recently a situation came up in PL/SQL code where the format specifier for date was misplaced. Oracle did not complain because it can implicitly convert strings to date. It may not even fail at run-time under most circumstances (always recommend using an explicit format specification though). This is the SQL ..but the Developer meant this: … Continue reading Oracle – Find Hard-coded Dates In PL/SQL Code Using Regular Expressions