web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

Store procedure error getting while deploying the Retail Package

(0) ShareShare
ReportReport
Posted on by 396

Hi Everyone,

Hope all are doing well....

I created a stored procedure where it accepts a table type as a parameter. For this i have also created the user defined table type in the development server. Same scripts also i added in the Database=>Custom folder to deploy in the UAT environment. At the time of deploying it is throwing error and package is not deployed. I found the below error in the Log file.

An error occurred when running the customization script G:\DeployablePackages\f6398d7d-fcdd-4d08-9e7e-a76c1b22dee5\RetailServer\Data\Upgrade\Custom\EXT_SP_INSERTLTITEMSTOCK.sql against db_d365opsprod_20191119_01522168_9949. Exception calling "ExecuteSqlText" with "1" argument(s): "Column, parameter, or variable #1: Cannot find data type ext.LTITEMSTOCKTABLETYPE.
Must declare the table variable "@TVP_LTITEMSTOCKTABLETYPE".
Parameter or variable '@TVP_LTITEMSTOCKTABLETYPE' has an invalid data type. Near statement:
CREATE PROCEDURE [ext].[SP_INSERTLTITEMSTOCK]
@TVP_LTITEMSTOCKTABLETYPE [ext].[LTITEMSTOCKTABLETYPE] READONLY
AS
BEGIN
INSERT INTO EXT.LTITEMSTOCK
SELECT * FROM @TVP_LTITEMSTOCKTABLETYPE
END
... "
11/19/2019 3:01:07 AM: ############### Error occurred: ###############
11/19/2019 3:01:07 AM: db_d365opsprod_20191119_01522168_9949 - An error occurred when deploying customizations for database. Deployment will continue for other databases, but this deployment will be marked as failed.
11/19/2019 3:01:07 AM: ############### Error occurred: ###############
11/19/2019 3:01:07 AM:
PSMessageDetails :
Exception : System.Management.Automation.MethodInvocationException: Exception calling "ExecuteSqlText" with "1" argument(s): "Column, parameter, or variable #1: Cannot find data type ext.LTITEMSTOCKTABLETYPE.
Must declare the table variable "@TVP_LTITEMSTOCKTABLETYPE".
Parameter or variable '@TVP_LTITEMSTOCKTABLETYPE' has an invalid data type. Near statement:
CREATE PROCEDURE [ext].[SP_INSERTLTITEMSTOCK]
@TVP_LTITEMSTOCKTABLETYPE [ext].[LTITEMSTOCKTABLETYPE] READONLY
AS
BEGIN
INSERT INTO EXT.LTITEMSTOCK
SELECT * FROM @TVP_LTITEMSTOCKTABLETYPE
END... " ---> System.Exception: Column, parameter, or variable #1: Cannot find data type ext.LTITEMSTOCKTABLETYPE.
Must declare the table variable "@TVP_LTITEMSTOCKTABLETYPE".
Parameter or variable '@TVP_LTITEMSTOCKTABLETYPE' has an invalid data type. Near statement:
CREATE PROCEDURE [ext].[SP_INSERTLTITEMSTOCK]
@TVP_LTITEMSTOCKTABLETYPE [ext].[LTITEMSTOCKTABLETYPE] READONLY
AS
BEGIN
INSERT INTO EXT.LTITEMSTOCK
SELECT * FROM @TVP_LTITEMSTOCKTABLETYPE
END... ---> System.Data.SqlClient.SqlException: Column, parameter, or variable #1: Cannot find data type ext.LTITEMSTOCKTABLETYPE.
Must declare the table variable "@TVP_LTITEMSTOCKTABLETYPE".
Parameter or variable '@TVP_LTITEMSTOCKTABLETYPE' has an invalid data type.

I have created a script also for "@TVP_LTITEMSTOCKTABLETYPE". Still it is throwing the same error.

Please help me to rectify the issue.....

I have the same question (0)
  • Verified answer
    Oksana Kovaliova Profile Picture
    3,597 on at

    Hi, did you add correct permissions to your table type?

    Below is tested & working sample

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    IF NOT EXISTS (SELECT * FROM sys.types WHERE is_table_type = 1 AND name = 'MYTABLETYPE')

    BEGIN

    CREATE TYPE [ext].[MYTABLETYPE] AS TABLE(

    [PARENTRECID] [bigint] NOT NULL,

    [PROPERTYNAME] [nvarchar](512) NOT NULL,

    [PROPERTYVALUE] [nvarchar](512) NULL

    )

    END

    GO

    GRANT EXECUTE ON TYPE::[ext].[MYTABLETYPE] TO [UsersRole];

    GO

    GRANT EXECUTE ON TYPE::[ext].[MYTABLETYPE] TO [PublishersRole];

    GO

  • Pankaj_93 Profile Picture
    396 on at

    Hi Oksana,

    Thank you very much for your response...

    It helps me alot...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 171 Super User 2026 Season 1

#2
Laurens vd Tang Profile Picture

Laurens vd Tang 108 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 102 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans