constraints

Oracle - drop table constraints without dropping tables.

I'm doing some bulk migration of a large Oracle database. The first step of this involves renaming a whole load of tables as a preparation for dropping them later (but I need to keep the data in them around for now). Any foreign key constraints on them need to be dropped - they shouldn't be connected to the rest of the database at all. I...

How do I change the "Indexed: Yes (No Duplicates)" constraint in Access to "Indexed: No" via SQL?

I need to change a column in MS Access from indexed to non-indexed. I need to do this via SQL because I do not have direct access to the database. I only have access to it via SQL. How do I do this? ...

XSD Identity Constraint with a node-set.

I'm having trouble generating an identity constraint due to a field evaluating to a node-set within my instances. Given a sample set of XML: <data> <Clusters> <Cluster FileID="0" Function="1"> <Isotopes> <Isotope StickID="0"/> <Isotope StickID="1"/> </Isotopes> ...

A better way to skip over javax.validation and org.hibernate compound-constraints

I have the following method that recursively breaks down a compound constraint into its component constraints: private void handleComposingConstraints(String friendlyName, Constraint parentConstraint, ConstraintDescriptor<? extends Annotation> parentDescriptor) { if(parentDescriptor.getAnnotation().annotationType().getName().indexO...

XmlSerializer requires XmlInclude for public method with generic constraint if type in another assembly AND requires that type to be serialiable!

Consider the following. You have a class that you want to serialize with XmlSerializer which has a public generic method with a type constraint where the type is in a different assembly: using BarStuff; namespace FooStuff { public class Foo { ... public T GetBar<TBar, T>( string key ) where TBar : Bar<T> { ... } ...

SqlServer constrain field value dependent on another field value

As the question title, is there a way to do this? eg: DrivingLicence --------------- CanDriveCar (bool) CanDriveMotorbike (bool) CanDriveBus (bool) You can't drive a bus without a car licence, so I want the DB to throw an exception if anyone tries to give someone a bus licence when they haven't a car licence. ...

C# Call generic method with stronger constraint

namespace Test { #region Not my code public interface IAdditional { } public interface ISome { ISomeOther<T> GetSomeother<T>() where T : class; } public interface ISomeOther<T> where T : class { void DoFoo(T obj); } public class AnotherClass<T> where T : class { } pu...

grails domain class validator + set unique constraint according to field values ?

Hi, Is there a way to write a custom validator that will perform different validations according to field values? For example class myModel{ A a; B b; String prop static belongsTo:[m:myModel] constraints{ prop(validator:{ val,obj-> if (obj.a== null){ unique:[b,prop] ...

How to form this SQL Constraint, and does it work in reverse?

Say I have "Table A": Id | Col A 1 Z 2 I 3 Null ...and n number of tables that have this format: Id | A_FK | OtherInfo 1 1 "Some info" 2 2 "Some more info" 3 3 "Blah" ...where A_FK is a foreign key reference to the "Table A" Id. So there is one "Table A", and n number of "Table B's". For these "B" ...

Drop constraints for a certain column

I need to delete all constraints for a certain column. I found this related SO question but the indicated script actually deletes all constraints related to a certain table, not only for certain columns in it. Is there a way of dropping only constraints applied on a given column? Alternatively, my bigger problem is, how to drop a colum...

Requirements for a WS to be considered restful

Hello all, in an answer from http://stackoverflow.com/questions/1261954/what-gets-classified-as-a-restful-web-service it is stated: There are a number of other constraints that a service must respect in order to be considered RESTful Where could I find the list of constraints? Thanks. ...

Create T-SQL Constraint to prevent x amount of duplicate records in table?

In table A I have 2 columns: ID (int, PK) MaxUsers (int) In table B I have 2 columns: ItemID (int) UserID (int) The number of records in table A with matching ItemID's cannot exceed the MaxUsers value. Is it possible to write a T-SQL Table Constraint so that it's not physically possible for this to ever happen? Cheers! Curt ...

Can I create a named default constraint in an add column statement in SQL Server?

In SQL Server, I have a new column on a table: ALTER TABLE t_tableName ADD newColumn NOT NULL This fails because I specify NOT NULL without specifying a default constraint. The table should not have a default constraint. To get around this, I could create the table with the default constraint and then remove it. However, there...

Worker Scheduling Algorithm

The Problem Here's the essence of the problem I want to solve. We have workers taking care of children in a nursery for set times during the weekend. There's 16 different slots to fill in one weekend. So for a 4-week month there's 64 slots to fill. We have at max 30 nursery workers (though we need much more. anybody like kids?). EDIT: ...

Why does this generic constraint compile when it seems to have a circular reference

I have written an extension method in csharp for an MVCContrib Html helper and was surprised at the form of the generic constraint, which on the face of it seems to circularly reference itself through the type parameter. This being said the method compiles and works as desired. I would love to have someone explain why this works and i...

Which Oracle view contains all constraints together?

I'm trying to get CONSTRAINTS from user_objects table like this: select CASE object_type WHEN 'DATABASE LINK' then 'dblinks' WHEN 'FUNCTION' then 'functions' WHEN 'INDEX' then 'indexes' WHEN 'PACKAGE' then 'packages' WHEN 'PROCEDURE' then 'procedures' WHEN 'SEQUENCE' then 'sequences' WHEN 'TABL...

Asp.net Routing - Route constraints and empty Route

I have a url that I want to map routing to: http://siteurl.com/member/edit.aspx?tab=tabvalue where tabvalue is one of: "personal", "professional", "values" or nothing. I want to map it to a route like: Member/Edit/{tab} But my problem is - I don't know how to specify such constraints. I'm trying this regex: ^[personal|professiona...

rails problem with routing and constraints

I have a problem with routing with an id conditioned by a regex constraint. My route is: resources :albums, :constraints => { :id =>/[a-zA-Z\d\.\-\_]+$/ } do get :offline, :on => :member end If I do this: GET /content/v1/albums/:id(.:format) {:action=>"show", :controller=>"content/v1/albums", :id=>/[a-zA-Z\d\.\-\_]+$/ It w...

How can I rewrite this MS SQL Script as a MySQL Script?

I'm trying to work my way through a Java Tutorial. The author wrote the tutorial to work with MS SQL. I'd like to follow the tutorial using MySQL. I'm not completely sure how to translate the MS SQL script which uses "IDENTITY", "CONSTRAINT", and "CLUSTERED" as you'll see below: CREATE TABLE [event_person] ( [event_id] [int] NOT NU...

Is there a way to apply c# generic constraints severally rather than jointly?

Is there a way to apply several different csharp generic constraints to the same type where the test is OR rather than AND? I have an extension method I want to apply to a subset of an interface, but there is no common interface or base class that only captures the classes I wish to target. In the example below, I could write multiple ...