Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Check Constraint in Visual Studio 2012 Database Project


Check Constraint in Visual Studio 2012 Database Project

Author
Message
JohnnyDBA
JohnnyDBA
Old Hand
Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)

Group: General Forum Members
Points: 348 Visits: 897
We have a VS 2012 .sqlproj database project. We would like to use a scalar valued user defined function to validate one of the table fields in the form of a check constraint.

Example:
ALTER TABLE [dbo].[MyTable] ADD CONSTRAINT [CK__MyTable__ColHID] CHECK (dbo.fnValidateHierarchy(ColHID) = 1);



What is the proper way to do this?

We keep experiencing the following error when adding this to the table definition script:

contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [dbo].[fnValidateHierarchy] or [dbo].[Mytable].[dbo]::[fnValidateHierarchy]. c:\...\dbo\Tables\MyTable.sql

JohnnyDBA
JohnnyDBA
Old Hand
Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)Old Hand (348 reputation)

Group: General Forum Members
Points: 348 Visits: 897
Ignore this topic. There was a type-o which caused the issue.

Please delete post.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search