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

Check Constraint in Visual Studio 2012 Database Project Expand / Collapse
Author
Message
Posted Wednesday, May 8, 2013 3:05 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Sunday, December 14, 2014 12:07 PM
Points: 342, Visits: 834
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
Post #1450812
Posted Wednesday, May 8, 2013 3:16 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Sunday, December 14, 2014 12:07 PM
Points: 342, Visits: 834
Ignore this topic. There was a type-o which caused the issue.

Please delete post.
Post #1450817
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse