Posts

Showing posts from January, 2020

New Youtube Channel

Image
Last year I noticed I was blogging way less than I should, in part because of new projects: work, personal stuff, local community activities, university projects... you name it. As for 2020's goals, I want to be more active on my blog and try new stuff as well. One of the new things I am doing is starting to record videos (my first experience doing this, even when I have presented a couple of webinars, this is a whole new skill to learn). According to some studies (don't ask me the accuracy of those), young people prefer videos over text, so I am giving it a try! What am I using? For now, my setup is very simple (and cheap): Blue Yeti microphone - Best mic to create videos or do webcasts ( check reviews ), connect and start using it. Logitech webcam C615 - not sure if I want to record myself!👽 Logitech G231 headset - Cheap but excellent sound and response, very comfortable also. Camtasia Studio - To screen record and video editing, I think everybody uses it

T-SQL Basics: using OUTPUT

Image
You are working on a database development project, and you need to obtain the records before/after an INSERT, DELETE, UPGRADE or MERGE Statement to present it to the user or do any work with that data. A common approach that I see a lot and involves a lot of code to obtain the before/after information can be the following (maybe some IF and TRY...CATCH also) : DECLARE @ id INT = 1 ; SELECT PostalCode , ModifiedDate FROM Person.Address a WHERE a.AddressID = @ id; UPDATE Person.Address SET PostalCode = 95012 , ModifiedDate = 'Jan 02 2020' WHERE AddressID = @ id; SELECT PostalCode , ModifiedDate FROM Person.Address a WHERE a.AddressID = @ id; The results will be something like this (before and after): And the execution plan will look like this, each extra SELECT statement adds more workload to our server (independently of the resources used) : Even when the code is easy to read, but if you use this pattern over all your code