Skip to content

Jim Salasek's SQL Server Blog

Sharing what I learn about Sql Server

  • Home
  • About
  • Contact

Recent Posts

  • Using dbatools to find orphaned files July 6, 2022
  • SSMS: Saving changes is not permitted error June 7, 2022
  • SQL Server: TableSample clause May 4, 2022
  • T-SQL: Create a running total April 6, 2022
  • Sql Server: Find the location your backups are going to. March 3, 2022
April 2017
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
« Mar   May »

Month: April 2017

View Jpg’s and other file types stored in a table

Do you have files stored in your SQL Server database and need to see what they are.  Here is a way using my favorite add-in SSMSBoost.

http://www.ssmsboost.com/

Continue reading View Jpg’s and other file types stored in a table

Posted on April 25, 2017April 15, 2017Categories UncategorizedLeave a comment on View Jpg’s and other file types stored in a table

Extract string before a special character

Here is an easy way to get (extract) all of the characters before a special character in a string.  In our example we have a listing of email addresses and we want to get the name before the @domain.

Continue reading Extract string before a special character

Posted on April 18, 2017March 25, 2017Categories Hints and TipsTags charindex, extract characters, extract string, substringLeave a comment on Extract string before a special character

Analytic Function — Lag

Starting with SQL Server 2012, Microsoft has included analytic functions within the database.  A couple that I use often, Lag and Lead, are very handy when you need to reference a previous or next row in a table without having to use self-joins or having to create a complicated sql statement.

Continue reading Analytic Function — Lag

Posted on April 11, 2017March 18, 2017Categories UncategorizedLeave a comment on Analytic Function — Lag

Count Rows per Hour

Here is a useful technique to know.  We have a delivery service and we want to know what hour of the day is most popular for completed deliveries.  Using the DATEPART function, this can be easily calculated.

Continue reading Count Rows per Hour

Posted on April 4, 2017March 12, 2017Categories Hints and TipsTags datapart, rows per hourLeave a comment on Count Rows per Hour
Create a website or blog at WordPress.com
  • Follow Following
    • Jim Salasek's SQL Server Blog
    • Join 27 other followers
    • Already have a WordPress.com account? Log in now.
    • Jim Salasek's SQL Server Blog
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar