SQL Server: DROP All But A Few Tables With PowerShell (or DROP ALL)

Recently, I received a request to backup a dozen tables or so tables out of 12 thousand tables. I had to retain all the indexes, statistics etc. The goal was to hand this over to the vendor for analysis as a database backup. I could have copied the selected tables over to a new database … Continue reading SQL Server: DROP All But A Few Tables With PowerShell (or DROP ALL)

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 – Return SELECT Statement Results Like SQL Server SP’s – Using Pipelined Functions

Note: You can find a simpler version of this in my answer on StackOverflow. Returning SELECT statement results from procedures/functions? Everyone is familiar with Oracle functions that return basic data types (simple values with no internal components). Although rarely used, Oracle functions are however capable of returning more complex data types like cursors, arrays and … Continue reading Oracle – Return SELECT Statement Results Like SQL Server SP’s – Using Pipelined Functions