Solved

Speed Up Stored Procedure sql server 2005 express

Posted on 2010-11-11
5
505 Views
Last Modified: 2012-05-10
sql server 2005 express  

I have a stored procedure that I would like to speed up in someway.

I'm using the "like"  operator...


Is there another way the same results but faster... ?


Thanks
fordraiders

USE [DescMatchGisXref]

GO

/****** Object:  StoredProcedure [dbo].[get_View_SAP_Data_Grid1]    Script Date: 11/11/2010 11:25:12 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[get_View_SAP_Data_Grid1]') AND type in (N'P', N'PC'))

BEGIN

EXEC dbo.sp_executesql @statement = N'-- =============================================

-- Author:		<Author,,Name>

-- Create date: <Create Date,,>

-- Description:	<Description,,>

-- =============================================

ALTER PROCEDURE [dbo].[get_View_SAP_Data_Grid1] @param3 nvarchar(100)  

AS	

SELECT     dbo.SapData.MFRNUM, dbo.SapData.MFRNAME, dbo.SapData.WWGDESC, dbo.SapData.ITEM, dbo.SapData.XREF, dbo.SapData.SPIN, 

dbo.SapData.REDBOOKNUM, dbo.SapData.WWGMFRNAME, dbo.SapData.WWGMFRNUM, WwgExtra.dbo.SapAltData.ALT1, 

WwgExtra.dbo.SapAltData.ALT1SPIN, dbo.SapData.RICHTEXT, dbo.SapData.COMMENTS, WwgExtra.dbo.SapAltData.ALT1DESC, 

WwgExtra.dbo.SapAltData.ALT1DESC2, WwgExtra.dbo.WwgExtra.GREEN, WwgExtra.dbo.WwgExtra.SEGMENT, 

WwgExtra.dbo.WwgExtra.PRIVATE_LABEL

FROM dbo.SapData INNER JOIN

WwgExtra.dbo.WwgExtra ON dbo.SapData.ITEM = WwgExtra.dbo.WwgExtra.ITEM INNER JOIN

WwgExtra.dbo.SapAltData ON WwgExtra.dbo.WwgExtra.ITEM = WwgExtra.dbo.SapAltData.ITEM

WHERE SapData.MFRNUM LIKE '''' + @param3 + ''%''

Open in new window

0
Comment
Question by:fordraiders
  • 2
  • 2
5 Comments
 
LVL 11

Assisted Solution

by:David Kroll
David Kroll earned 250 total points
Comment Utility
I'd put (nolock) after each table name

FROM dbo.SapData (nolock) INNER JOIN
WwgExtra.dbo.WwgExtra (nolock)

Also make sure that you have indexes on the fields that you are joining the tables on (SapData.ITEM and SalAltData.ITEM).  Also put an index on SapData.MFRNUM.
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 250 total points
Comment Utility
the problem here is the like operator,the only way to improve the like operation here is to have full text indexing on that column, and modify your query accordingly. but it can add some overhead to the system
0
 
LVL 3

Author Comment

by:fordraiders
Comment Utility
WHAT DOES "nolock"  DO never seen that before ?
0
 
LVL 11

Expert Comment

by:David Kroll
Comment Utility
0
 
LVL 3

Author Closing Comment

by:fordraiders
Comment Utility
Thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now