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 6891555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:25:30+00:00 2026-05-27T06:25:30+00:00

Database server is Microsoft SQL Server, but I don’t have Administrator access to it.

  • 0

Database server is Microsoft SQL Server, but I don’t have Administrator access to it.
So, I don’t know which version, and I don’t know which indexes exist.

To access the database, I am using ADO.

Here is the SQL statement:

-- Get master objid and order_number and activity time
SELECT A.objid,
       A.order_number,
       F.entry_time
-- From these tables
FROM   dbo.table_master as A,
       dbo.table_activity as F
-- link of the tables
WHERE  F.objid = A.objid
       -- Retrieve code = 1900 only
       AND F.code = 1900
       -- Which have info like this:
       AND F.info LIKE '%to SUPPORT.'
       -- And entry time between these times:
       AND F.entry_time >= '2011-10-01 00:00:00'
       AND F.entry_time <= '2011-12-05 23:59:59'
-- We want the earliest entry (because there might be multiple code = 900 and info like)
ORDER  by F.entry_time  

Is it possible to optimize this?

Thanks

  • 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-27T06:25:31+00:00Added an answer on May 27, 2026 at 6:25 am

    Here are things you could do differently:

    • use RIGHT(f.info, 11) = 'to SUPPORT.' instead of F.info LIKE '%to SUPPORT.'
    • use an INNER JOIN as @xQbert suggested
    • use BETWEEN for the date range instead of the combination of < and >.

    In my testing, the only one that made a difference in performance was the first option. All 3 items will generate the same execution plan, however, the RIGHT function was around 10x quicker in my test in terms of actual execution time. I’m using STATISTICS TIME to test.

    If possible, I would try to get access to look at the indexes. Having the tables properly indexed will make a way bigger difference than the RIGHT function.

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

Sidebar

Related Questions

We have a Microsoft SQL Server 2005 database that needs to be converted back
I Want Print DataBase Schema in Microsoft Sql Server Compact Edition. Maybe Exist Some
Microsoft SQL Server has a nice feature, which allows a database to be automatically
I have a local Microsoft SQL Server Compact 3.5 database (.sdf) in my WPF
I have been working with Microsoft SQL Server since 6.5 along with other database
We've got a product that uses a Microsoft SQL Server database. We've got customers
I need a tool that will look at a Microsoft SQL Server database and
I need to create several applications that all share a Microsoft SQL Server database.
Using Microsoft SQL Server's database mirroring capability, can the mirroring occur between two clusters?
I'm using Microsoft SQL Server Management Studio to work with a database. I'm only

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.