eConnect taItemSite Wrapper

This stored procedure wraps the eConnect taItemSite stored procedure, making it easier to call. 

It also returns the full error text in case of an error, and not just the cryptic error ID

IF EXISTS (SELECT name
       FROM   sysobjects
       WHERE  name = N'dd_taItemSiteWrapper'
       AND    type = 'P')
    DROP PROCEDURE dd_taItemSiteWrapper
GO
 
CREATE PROCEDURE dd_taItemSiteWrapper
 
-- dd_taItemSiteWrapper 'mortarcovers~~','020',0
 
@ITEMNMBR varchar(30),
@LOCNCODE varchar(10),
@UpdateIfExists int
 
AS
 
set transaction isolation level read uncommitted
DECLARE @O_iErrorState INT,
    @oErrString VARCHAR(256),
    @ErrorDesc VARCHAR(256)
 
SELECT @O_iErrorState = 0
 
EXEC taItemSite
    @I_vITEMNMBR = @ITEMNMBR,
    @I_vLOCNCODE = @LOCNCODE,
    @I_vUpdateIfExists = @UpdateIfExists,
    @O_iErrorState = @O_iErrorState OUT,
    @oErrString = @oErrString OUT
 
IF @O_iErrorState > 0 BEGIN
    SELECT @ErrorDesc = tec.ErrorDesc
        FROM dynamics..taErrorCode tec
        WHERE tec.ErrorCode = @O_iErrorState
END ELSE BEGIN
    SELECT @ErrorDesc = ''
end
 
 
SELECT @O_iErrorState AS ErrorState, @oErrString AS ErrString, @ErrorDesc AS ErrorDesc
 
 
 
GO
 
grant exec on dd_taItemSiteWrapper to public
--  sp_sps 't'

RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences