5

I am getting the following error with my database project in VS2012. The problem started when I added a custom type in my Database project in VS2012.

CREATE TYPE [dbo].[DestAttractions] AS TABLE(
[TAAttractionId] [varchar](10) NOT NULL,
[TARatingImgUrl] [varchar](256) NULL,
[TAReviewCount] [int] NULL,
[TAReviewUrl] [varchar](256) NULL)

When I try to reference the type in stored procedure which is also part of the database project

CREATE PROCEDURE [dbo].[spupd_DestinationTripAdvisorData]
@DestinationId INT,
@TAAwardImgUrl VARCHAR(256),
@Attractions dbo.DestAttractions READONLY
AS
BEGIN

------
------
END

And build the database project I keep on getting the following error which is quite annoying since the stored procedure works flawlessly and there is no problem with the type.

SQL71501: Parameter: [dbo].[spupd_DestinationTripAdvisorData].[@Attractions] has an unresolved reference to Built-in Type [dbo].[DestAttractions]. Any pointers or help will be much appreciated.

3
  • Try rebuilding the project, or try again after closing VS and reopening it. I've seen this behavior before with custom types and never quite understood why it happens. Commented Feb 23, 2015 at 20:19
  • 6
    Also check the custom type's file properties in VS and make sure Build Action is set to Build. Commented Feb 23, 2015 at 20:20
  • Thanks Keith. That worked like a charm. Can't believe I missed the build action for the type's file properties. Commented Feb 24, 2015 at 5:17

1 Answer 1

12

In my case the solution was to change the Build Action of file what contains the type definition to Build.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.