Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8612775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:42:39+00:00 2026-06-12T04:42:39+00:00

I was looking at the SSMS Tools Execution Plan Analyzer and it said to

  • 0

I was looking at the SSMS Tools Execution Plan Analyzer and it said to try breaking it up into smaller chunks. Is the following query the best way I can do “this”? Any help is much appreciated!

SELECT t1.ID,
t1.col2,
t1.col3,
t1.col4,
t2.ID AS table2ID,
t2.col2,
t1.col5,
t1.col6,
t2.StatusID as table2StatusID
CASE WHEN LEN(t2.ErrorMessage) > 0 THEN t3.StatusName + ' ' + t2.ErrorMessage 
             ELSE t3.StatusName
     END AS SomeStatus,
     t3.StatusTypeID AS StatusTypeID
FROM table1 t1
INNER JOIN table2 t2 ON t1.ID = t2.ID
INNER JOIN table3 t3 ON t2.StatusID = t3.StatusID`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:42:40+00:00Added an answer on June 12, 2026 at 4:42 am

    You can replace your case when with an ISNULL() which might reduce the per row processing cost.

    t3.StatusName + ISNULL(' ' + t2.ErrorMessage, '') as SomeStatus
    

    Without knowing a great deal about your schema setup it’s difficult to tell where optimizations can be made. What might be intuitive optimizations might go against business logic and be useless. The alternative is true, there could be some short cuts to getting the data that isn’t obvious without knowing the business logic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When looking at the actual execution plan for a query in SQL Server Management
Looking at some assembly code for x86_64 on my Mac, I see the following
Looking to do a bit of refactoring... Using NHibernate I have this query currently
Looking at the Ehcahce implementation of net.sf.cache.JS107, I am trying to achieve the following
Looking for best advice on how to do this: I have an insert like
I am using SSMS 2008 and am looking for a way to replace records
I am looking for some reference code implementing a SSMS 2008 plugin. Can somebody
Looking at the following code, does theme[sprite].img get nested inside result[definition].data (as theme[sprite].img is
Looking at the docs for the .each() function in jquery shows the following method
I am designing an application and I'm looking for the best way to tell

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.