Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Stored Procedure Tuning Expand / Collapse
Author
Message
Posted Thursday, June 27, 2013 4:17 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, August 03, 2013 12:36 PM
Points: 2, Visits: 14
Hi There,

I have this below mentioned stored procedure which I am executing through VB.NET what is the best way to Fine tune it, I appreciate all the ideas and suggestion, if possible with example.

USE [PRD]
GO
/****** Object: StoredProcedure [dbo].[SD_InsertInventoryItem1] Script Date: 06/27/2013 14:51:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[SD_InsertInventoryItem1]
-- Add the parameters for the stored procedure here
@ITEMNMBR Varchar(30),
@VENDOR Varchar(30),
@ITEMDESC Varchar(100),
@ITMSHNAM Varchar(15),
@ITMGEDSC Varchar(10),
@ITMCLSCD Varchar(10),
@ITEMTYPE smallint,
@VCTNMTHD smallint,
@TAXOPTNS smallint,
@ITMTSHID Varchar(15),
@UOMSCHDL Varchar(10),
@ITEMSHWT numeric(8,2),
@TCC Varchar(30),
@CNTRYORGN VarChar(6),
@CURRCOST Numeric(20,1),
--Parameters For Taxonomy.
@TDepartment Varchar(255),
@TSubDept Varchar(255),
@TClass Varchar(255),
@TSubClass Varchar(255),
--Parameters HTS window.
@TCustomDesc VarChar(255),
@TCountry Varchar(55),
@THSCode Numeric(6),
@TExportCode Numeric(4),
--OutPut Parameters.
@iErrorState int output,
@ErrString varchar(255) output
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Executing the Stored Procedure to Insert the Inventory Items.
If @ITEMNMBR <> (SELECT ITEMNMBR FROM IV00101 WHERE ITEMNMBR = @ITEMNMBR)
BEGIN
EXECUTE dbo.taUpdateCreateItemRcd
@I_vITEMNMBR = @ITEMNMBR,
@I_vITEMDESC = @ITEMDESC,
@I_vITMSHNAM = @ITMSHNAM,
@I_vITMGEDSC = @ITMGEDSC,
@I_vITMCLSCD = @ITMCLSCD,
@I_vITEMTYPE = @ITEMTYPE,
@I_vVCTNMTHD = @VCTNMTHD,
@I_vTAXOPTNS = @TAXOPTNS,
@I_vITMTSHID = @ITMTSHID,
@I_vUOMSCHDL = @UOMSCHDL,
@I_vITEMSHWT = @ITEMSHWT,
@I_vTCC = @TCC,
@I_vCNTRYORGN = @CNTRYORGN,
@I_vCURRCOST = @CURRCOST,
@I_vUseItemClass = 1,
@O_iErrorState = @iErrorState OutPut,
@oErrString = @ErrString Output;

EXECUTE dbo.taCreateItemVendors
@I_vITEMNMBR = @ITEMNMBR,
@I_vVNDITDSC = @ITEMDESC,
@I_vVENDORID = @VENDOR,
@I_vVNDITNUM = @ITEMNMBR,
@I_vFREEONBOARD = 1,
@O_iErrorState = @iErrorState OutPut,
@oErrString = @ErrString Output;

EXECUTE dbo.SD_InsertTaxonomyValues
@ITEMNMBR = @ITEMNMBR,
@Department = @TDepartment,
@SubDept = @TSubDept,
@Class = @TClass,
@SubClass = @TSubClass;

EXECUTE dbo.SD_InsertHTSValues
@ITEMNMBR = @ITEMNMBR,
@TCustomDesc = @TCustomDesc,
@TCountry = @TCountry,
@THSCode = @THSCode,
@TExportCode = @TExportCode

ELSE
-- Return unused error state

SET @iErrorState = 2627;
SET @ErrString = 'Duplicate Item Number, Sku Already Exists in the Database.';
END
END
Post #1468376
Posted Thursday, June 27, 2013 5:20 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 2:20 PM
Points: 2,763, Visits: 5,903
The easy answer: You can't tune this SP.
This procedure is calling other procedures and we would need to know the definition of those stored procedures as well.
To get better help on this kind of issues, read the following article
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/



Luis C.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1468395
Posted Thursday, June 27, 2013 9:03 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 10:59 AM
Points: 35,951, Visits: 30,239
I agree. This proc probably isn't the problem.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

"Change is inevitable. Change for the better is not." -- 04 August 2013
(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1468415
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse