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

  • Home
  • SEARCH
  • 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 901867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:37:37+00:00 2026-05-15T15:37:37+00:00

On my current project I’m using SQL CE. Since it doesn’t have support for

  • 0

On my current project I’m using SQL CE. Since it doesn’t have support for stored procedures I have to write sql queries inside repository.

Option 1:

StringBuilder query = new StringBuilder();
query.Append("SELECT");
query.Append("    c.CUSTOMER_ID,");
query.Append("    COALESCE (c.FIRST_NAME, '') + ' ' + COALESCE (c.LAST_NAME, '') AS FULL_NAME");
query.Append("    ct.NAME as CUSTOMER_TYPE");
query.Append("FROM ");
query.Append("    CT_CUSTOMER_TYPE AS ct INNER JOIN CUSTOMER AS c ON ct.CUSTOMER_TYPE_ID = c.CUSTOMER_TYPE_ID");

Option 2:

string query = "SELECT c.CUSTOMER_ID, COALESCE (c.FIRST_NAME, '') + ' ' + COALESCE (c.LAST_NAME, '') AS FULL_NAME, ct.NAME as CUSTOMER_TYPE FROM CT_CUSTOMER_TYPE AS ct INNER JOIN CUSTOMER AS c ON ct.CUSTOMER_TYPE_ID = c.CUSTOMER_TYPE_ID";

Option 1 seems like a much more readable, especially when I have 10+ tables in join, but option 2 is faster.
Which option should I accept and what’s the best practice in this case?

  • 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-05-15T15:37:37+00:00Added an answer on May 15, 2026 at 3:37 pm

    Option 2 may be a few nanoseconds faster, but when you add the time to actually execute in the database (several milliseconds) a few extra nanaoseconds barely registers as noise.

    In any case, there is another option that’s the best of both worlds: @-strings:

    string query = @"
        SELECT
            c.CUSTOMER_ID,
            COALESCE (c.FIRST_NAME, ''_ + ' ' + COALESCE (c.LAST_NAME, '') AS FULL_NAME
            ct.NAME as CUSTOMER_TYPE
        FROM
            CT_CUSTOMER_TYPE AS ct INNER JOIN CUSTOMER AS c
                ON ct.CUSTOMER_TYPE_ID = c.CUSTOMER_TYPE_ID
        ";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my current project we're trying to write an application (using SUN RI JSF
On my current project we're using Spring 3 MVC and have a requirement to
in my current project I'm using code first approach. I have a type called
My current project involves using LDAP (Active Directory) and I'm using issue tracking for
On my current project, which is a delivery system, I have a list of
For my current project I have to send a signature from PHP to Java
In my current project, I am going to write a function of calculating average
My current project's UITableViewCell behavior is baffling me. I have a fairly straightforward subclass
My current project is to write a program that basically is a cash register
Our current project does not use Hibernate (for various reasons) and we are using

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.