https://d33wubrfki0l68.cloudfront.net/3762c1a26ede5efcb0fb514523e42e656ea6fe83/02144/images/sheldonhull_gopher_avatar.png

Sheldon Hull

sheldonhull@macbook: ~/ (pwsh)
  • _________________________________
  • < Welcome! Thanks for stopping by >
  •  ---------------------------------
  •  \
  •   \
  •      __
  •     /  \
  •     |  |
  •     @  @
  •     |  |
  •     || |/
  •     || ||
  •     |\_/|
  •     \___/

Here you’ll find mostly tech talk and musings, with other topics periodically. If you want to stay in touch, look at the bottom for the curated newsletter I send out.

Cheers! 🙏🏻


snippet designate a certain time of the day in getdate()

Snippet to designate a certain time of the day to evaluate in the current day. If you need to limit a result to the current date after a particular time, strip the time out of the date, and concatenate the current time together with it, and then convert back to datetime2. 1 select convert(datetime2(0),cast(cast(getdate() as date) as varchar(10)) + ' 09:00 ')

Native SSMS a second class citizen no longer...

Intellisense can be a boon to adding quick development. Quick hints on scope specific variables, syntax suggestions, function descriptions and more provide a valuable tool to productive coding.Coding in SQL Server Management Studio (SSMS) has greatly improved over the version releases, but it still lags behind the power of Visual Studio’s intellisense, template insertions with “fill in the blank” functionality . Additionally, the lack of automatic indentation means that lining up sub-queries and levels of logic can be annoyingly time consuming… especially when not everyone on a team following the exact same coding standards.

dynamic sql and a char crash

Dynamic SQL can be helpful, but a pain to debug. I spent hours today working on figuring out why my simple date comparison in dynamic SQL wasn’t working. Found out that the remote database I was connecting to had a char date instead of a datetime. I found the comparison of CHARDATE > VARCHARDATE failed to error out, but also failed to give a proper result set. Changing the look-up to ensure both dates were converted to date fixed the issue.

How to default SSRS date parameters to the first and last day of the the previous month

Populating default dates in SSRS can be helpful to save the user from having to constantly input the date range they normally would use. When a report is pulled for last month’s information, defaulting the date fields for the user can help streamline their usage of the report, instead of them manually selecting with the date-picker control in SSRS. The formula’s I used were: 1 2 3 Beginning of Current Month (EOM) DateSerial(Year(Date.