Thoughts On When To Use – Write-Host, Write-Output, Write-Debug, Write-Warning, Write-Verbose & Write-Error/Throw

PowerShell has matured as the automation tool of choice on the Microsoft platform, be it on Windows or Azure. However, there is no official guidance on best-practices and standards around some¬†things. At times, bloggers do things incorrectly in their examples thereby reinforcing bad practices.¬†Hopefully, this small post will help connect some dots for you! Please … Continue reading Thoughts On When To Use – Write-Host, Write-Output, Write-Debug, Write-Warning, Write-Verbose & Write-Error/Throw

Advertisements

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)

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

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

Oracle – Quick Tip – Replace Explicit Cursors With FOR LOOP In PL/SQL

Caution: If your cursor logic has a "FOR UPDATE" clause, please leave it in place as it locks the records in the Resultset for the update (until next COMMIT or ROLLBACK) and you will open up your code for unnecessary race conditions by replacing that with FOR LOOP (like two people reserving the same seat … Continue reading Oracle – Quick Tip – Replace Explicit Cursors With FOR LOOP In PL/SQL