SQL Tact

pointers, solutions and scripts for the SQL DBA
not intended to replace msdn, common sense or oxford commas

Tuesday, October 03, 2017

VS Code: PowerShell and focusConsoleOnExecute

If you're used to the behavior of SSMS or PowerShell ISE where upon executing code in the script panel, your cursor stays in the script panel, then the behavior of Visual Studio Code's PowerShell default might be annoying. By default in Code, your cursor moves down to the PowerShell console terminal upon executing code.

Maybe that's your thing. If not, there's a preference you can change, immediately.

In Code, go to the File Menu -> Preferences to launch the User Settings screen. There's a setting to overwrite the default called powershell.integratedConsole.focusConsoleOnExecute, that's what you're looking for. Add it to the right-side of the Code settings window like this:
{ "powershell.integratedConsole.focusConsoleOnExecute": false,

It'll look like this:

The change takes place immediately.
Not using Code yet? Hop to! https://code.visualstudio.com/Download

My former long-ago colleague and PowerShell prize-winning guru Mike F Robbins has a good blog post and video getting you up to speed on Code, he discusses powershell.integratedConsole.focusConsoleOnExecute and more.

Thursday, September 14, 2017

Twilight Timezone: Date and Time Architecture in your Applications aka Use DateTimeOffset, Your Future Self Thanks You

Thanks to everyone at a joint meeting of the Baton Rouge .NET and SQL Server User Groups who joined my colleague Steve Schaneville and me for a presentation on date/time data architecture in modern applications last night.

We reviewed the SQL and .NET architecture for date/time storage an informative and thought-provoking talk about handling timezones in your application architecture. Dealing with Time Zones is disconcerting, rarely straightforward, and often complicated! In the end, our architecture recommendations lead to two likely best paths - either using datetimeoffset (and optionally also storing the Time Zone Name information in a separate field) or storing the date and time in separate fields. (But preferably datetimeoffset.) There are few advantages and major disadvantages to storing only UTC data or all-in-one time zone data.

Steve and I are the principal consultants for appdev and SQL Server respectively at Sparkhound, and have worked hard to put together a joint presentation on this topic that is valuable to both audiences. We got a lot of great questions and positive feedback, as well as more notes to add to our presentation the next time, which will likely be at Houston Tech Fest 2017 in October. Got questions/feedback for us, actual use cases or lessons learned? Please reach out to us, our emails are at the end of the slide deck below.

You can download the slidedeck and sample code here.

UPDATE: Related to Steve and I's presentation on date time architecture, check out our colleague Vance's blog post on serialization: http://www.sparkhound.com/learn/blog/date-demo-blog

Friday, August 04, 2017

SQLSat Planner's Calendar

We just completed our 9th annual SQLSaturday Baton Rouge. In my post-mortem of the event, I've updated and tweaked the living, breathing SQLSaturday Planner's Calendar that I've been crafting for a couple years now.

If you are a SQLSaturday organizer of any level of veterancy, you may find this calendar helpful in remembering to keep up with the months-long building to your event. If you're on some of the SQLSat Slacks you have may seen an earlier version of this doc, and already I've received a ton of good feedback. I am open to feedback on what to add/move/modify in this calendar, please reach out one or another if you have some wisdom that another SQLSat organizer or I need to hear.


Let me know if you have any questions or feedback!