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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:47:02+00:00 2026-06-08T04:47:02+00:00

I’m trying to execute stored procedure on SQL Server 2008 from C# application. It

  • 0

I’m trying to execute stored procedure on SQL Server 2008 from C# application. It takes a lot of time and my application “not responding”. My stored procedure:

ALTER PROCEDURE [dbo].[PROC066]
@date_1 date,
@date_2 date
AS
SELECT
RTRIM(tt1.[Org]) as 'Org', 
RTRIM(tt1.[CustomerHQ]) as 'Customer',
RTRIM(tt1.[Customer]) as 'ShipTo', 
RTRIM(tt1.[Date]) as 'Date', 
RTRIM(tt2.Clean) as 'Clean', 
RTRIM(tt1.[PO number]) as 'PONumber',
RTRIM(tt1.[GCAS]) as 'GCAS',
'Description' = (SELECT DISTINCT [Description] FROM tDeploymentDB WHERE tDeploymentDB.[Item Code] = tt1.[GCAS]),
RTRIM(tt1.NQTY) as 'NQTY',
RTRIM(tt1.[Dummy]) as 'Dummy', 
RTRIM(tt1.[MOQ]) as 'MOQ', 
RTRIM(tt1.[Inactive]) as 'Inactive', 
RTRIM(tt1.[Allocation]) as 'Allocation', 
RTRIM(tt1.[MultiSector]) as 'MultiSector',
RTRIM(tt2.Pallet_Checked) as 'FullPallets',
RTRIM(tt2.FullTruck_Checked) as 'Full_Truck',
FROM tCleanOrderTracking_prod as tt1, tCleanOrderTracking_HDR_prod as tt2
WHERE 
SUBSTRING(RTRIM(tt1.[PO number]), 6, LEN(RTRIM(tt1.[PO number])) - 5) = 
RTRIM(tt2.CustomerOrderNumber) AND 
tt1.[Date] = @date_1 AND tt1.[Date] <= @date_2
ORDER BY Org, [PO Number]

If I’m trying to execute this procedure on SQL Server Management Studio – it takes 5-7 sec. But through C# I can’t to execute this query. I was trying to delete this row in query

tt1.[Date] = @date_1 AND tt1.[Date] <= @date_2

After that it works fine.. my application takes 5 sec for executing. Also I was trying to rewrite this row

tt1.[Date] BETWEEN @date_1 AND @date_2

No result! My main table in query tCleanOrderTracking_prod have about 40500 records. What can I try else? What I’m doing wrong?

  • 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-08T04:47:03+00:00Added an answer on June 8, 2026 at 4:47 am

    Have a look at How to read SQL Server execution plans it will show you how to analyse your own SQL Query and make improvements on speed and execution performance.

    You want to run this against your query and look HOW it is being executed so that you can add indexes / change joins etc etc.

    The Trim function is also a computationally expensive function, its not just a select from a row but a processing command. Running it on 40,000 can take quite a hit. Consider only doing it on columns you need it on, and do it during INSERT time and not select time (then you do it once, not a million times 😉 ).

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from

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.