Posts

PostgreSQL Trigger Example

Image
 Triggers can be handy at times, but I tend to stay away from them as long as possible, because they can cause performance degradation at times, plus I tend to forget they're hiding behind the scenes, doing random things.  In any case, let's see how you can create a simple trigger in Postgres. Steps Create a lookup table Create a parent table Create a child table Create trigger function to convert lookup value to handle Inserts/Updates/Deletes For inserts and updates, convert lookup value to look up id Create trigger Test .. by running several 1000 inserts, updates and deletes Replace myschema with the name of your schema -- Create Lookup Table create table myschema.lookuptable ( lookupid integer not null , lookupvalue varchar ( 50 ) not null , constraint pk_lookuptable primary key (lookupid) ); insert into  myschema.lookuptable (lookupid, lookupvalue) values ( 1 , 'hello' ), ( 2 , 'bonjour' ), ( 3 ...

Western United States Landscapes

Image
These are 5K resolution (5120x2880 pixels) that I clicked, for your personal use only as desktop wallpapers.  Click on an image for a larger version and if you want the 5K resolution, right-click and open image in a new tab. Rainbow after a storm high up on Pike's Peak, Colorado Beautiful winter morning in Albuquerque, New Mexico Thunderstorm, high up in the Rocky Mountain National Park, Colorado Aspen trees in Autumn near Aspen, Colorado Clouds hanging, Mount Evans, Colorado Beautiful lake and reflections, somewhere near the Continental Divide in Colorado Autumn colors at Maroon Bells, Colorado Clouds and Mountains, Sandia Mountains, New Mexico Layers of blue, driving up Mount Evans, Colorado The kind of day you read about, a prairie on the Kansas-Colorado border On the ledge, looking at the valley, Mount Evans, Colorado Fascinating God's Rays near Kansas-Colorado border

4K Wallpapers Set 1

Image
Here's a set of twelve images that I clicked, that you can use as your desktop wallpaper if you like.  These are for your personal use only.  Click on an image for a 4K version.  Hope you enjoy them and if you like talking photography, whether it be Digital Single Lens Reflex (DSLR) or Mirrorless Interchangeable Lens Camera (MILC), please contact me and I'll be happy to share my knowledge as well as learn from you. Great Blue Heron, Ozarks, Missouri American Kestrel, Riverlands Migratory Bird Sanctuary, Missouri Butterfly, Faust House, Chesterfield, Missouri Common Mergansers, Green Bay, Wisconsin Fall colors in Wisconsin Water Lily, Chicago, Illinois Gulls and Sunrise, Jacksonville Beach, Florida Hot Air Balloon, Saint Louis, Missouri Lighthouse, Cape Elizabeth, Maine Trumpeter Swan, Loess Bluffs Wildlife Refuge, Missouri Tulips, Saint Louis, Missouri Willet, Jacksonville Beach, Florida

C# App to compare 2 SQL Server Stored Procedure Outputs

Image
C# App to compare 2 SQL Server Stored Procedure Outputs Ever had to compare the output result sets of 2 stored procedures in SQL Server?  Well, today I had to find a solution because one of the teams I work with is changing code for performance improvement and needs to compare result sets between the old and new version to ensure the results did not change.  The trouble is - the solution has to handle procedures returning 1, 2, 3, ... n result sets.  This makes it more complicated as you cannot insert the output of the procedure into a table or temp table and compare using FULL JOINS. Here is an example Procedure 1 CREATE OR ALTER PROCEDURE [dbo] . [sp_MultipleResultsets_1] ( @int_Param1 int , @int_Param2 int ) AS BEGIN -- Set 1 SELECT TOP 100 OrderId , UserId , OrderTime , ProductCount , TotalPriceUSD , DiscountCode   FROM dbo . MSTVF_Orders ORDER BY OrderId -- Set 2 SELECT TOP 100000 OrderId , UserId , OrderTime , P...