constraint

T-SQL Unique constraint locked the SQL server

HI ! This is my table: CREATE TABLE [ORG].[MyTable]( .. [my_column2] UNIQUEIDENTIFIER NOT NULL CONSTRAINT FK_C1 REFERENCES ORG.MyTable2 (my_column2), [my_column3] INT NOT NULL CONSTRAINT FK_C2 REFERENCES ORG.MyTable3 (my_column3) .. ) I've written this constraint to assure that combination my_column2 and my_c...

insert value of one col to another on inserting

hi, i want to insert value of one col to another on inserting new row in sql. how do i? there is any way to do this by default value(constraint)? ...

Language to constrain large datasets for ruby/java and javascript

I got a backend web service containing massive amounts of data that I have control over and I need to fetch data from it through a browser frontend. The frontends task is to simply display the data in a paged table but the user should be able to dynamically constrain the data based on the fields and i can't load the entire matching data ...

Can I name my constraints with JPA?

When I use the maven-hibernate3-plugin (aka hbm2ddl) to generate my database schema, it creates many database constraints with terrifically hard-to-remember constraint names like FK7770538AEE7BC70 . Is there any way to provide a more useful name such as FOO_FK_BAR_ID ? If so, it would make it a tad easier to track down issues in the lo...

NHibernate - Name Primary key constraint?

Hi, We're starting to using NHibernate at my workplace, including generating the schema from the mappings. One thing our DBAs want is consistent names for the primary and foreign key relationships. I've been able to set the FK constraint name, but looking at the documentation for <id> it doesn't look like there's a way to name the pri...

using constraint layout and percentage layout together flex

Hi, I'm trying to use percentage based layout along with contraint based layout to achieve the following layout http://imgur.com/rgoBe.jpg I have 3 canvas set in my app with the correct percentages but I setting things like top=10 left = 10 to create "border margins" has no effect. How can I fix this? EDIT <containers:GradientVB...

SQL Server composite key problem

I have 2 tables: create table numbers2 ( id1 int IDENTITY(1,1) not null, id2 int not null, primary key(id1, id2) ) and table 2 create table ttt ( id int identity(1,1) not null, first_name varchar(50) null, last_name varchar(50) null, sex varchar(1) check (sex in ('m', 'f')) null, number_id int not null, id_id1 int not null, id_id2 i...

RhinoMocks expecting call with the exact value

Sometimes Rhino.Mocks is driving me mad, 'cause there's not enough documentation on topics that, I suppose, are relatively easy. What I want to do is to expect call to AddContact("test", contact). So for the second parameter I must use parameter constraint Property.AllPropertiesMatch(contact). But what should I use for the first one? _...

sqlite constraint failed error code

Hi all, I have two tables albums and songs and each song has reference to alum's id. Album table : CREATE TABLE albums (id INTEGER PRIMARY KEY ASC, name TEXT, additional TEXT) Song table: CREATE TABLE songs (id INTEGER PRIMARY KEY ASC, album_fk INTEGER NOT NULL, title TEXT, url TEXT, duration BIGINT NOT NULL) and i also have a tri...

uniqueness of composite id with null component

Hi, I am running into problems using unique constraints. The following combinations are allowed A.name B.name foo NULL foo bar foo bar1 foo1 bar It should not be possible to create a new A with same name, only if it has a different B. With the constraints below it is possible to create A.name B.name foo NULL foo ...

ORACLE - Dropping a constraint when the table doesn't exist

So for a weird reaon my table was dropped but the constraints remained so I cannot recreate the table with the same constraints.. Is there a way I can drop those constraints? When I do a select in the all_constraints table: select * from all_constraints where CONSTRAINT_NAME like 'C710%'; I get this: ("x" being the table_name which me...

C#. Is is possible to have a static generic class with a base type constraint that has a method with a further base type constraint

I'd like to be able to create a static generic type with a base type constraint like public static class Manager<T> where T : HasId { public static T GetSingleById(ref List<T> items, Guid id) { // the Id is a property provided by HasId return (from i in items where i.Id == id select i).SingleOrDefault(); } } ...

Generic in type constraint

I'm struggling with some generics. The following is my setup: interface I<T> { } [...] void Add<T>(T obj) where T : I<??> { } How can I ensure that T in the Add method implements I? ...

JQuery UI Slider with Multiple handles: How to stop the handles from crossing ?

Hi, I'm developing a quick solution that uses a Slider with multiple handles to define widths for a dynamic layout. I've attempted to use both ExtJS3 and the latest JQuery UI. In ExtJS, you can constrain the handles so the don't cross over each other, and it's quite an intuitive approach to the UI I need, however there are reasons why...

How to handle JPA unique constraint violations?

When a unique constraint is violated, a javax.persistence.RollbackException is thrown. But there could be multiple reasons to throw a RollbackException. How can I find out that a unique constraint was violated? try { repository.save(article); } catch(javax.persistence.RollbackException e) { // how to find out the reason for the ...

SQL Constraint/trigger - Is it possible to write a constraint that checks "when you Insert a record it must contain one of two fields"?

Is it possible to have a constraint/trigger on a record being entered that checks if the user has entered at least one of three fields (all of which can be null). For example, I have a database being used to track bugs and new features in other pieces of software. When a bug is discovered a Feature record is created which can have three ...

Force generic interface implementation in C#

Is there anyway to force a constraints for a generic definition to implement a "generic interface" ... that is, I want the class to support passing an interface and a generic class constraining it so that the class implements the interface. For example if I say: MyGenericClass<IMyInterface, MyImplementation>.DoSomething(); That should...

How to impose, in a C# generic type parameter, that some operators are supported?

Hello, I am recently working on a C# class library implementing an algorithm. The point is that I would like the users of the library to be able to choose the machine precision (single or double) the algorithm should operate with, and I'm trying to do it with generics. So, for instance: Algorithm<double> a = new Algorithm<doubl...

SQL Server 2008: Check constraints that guarantees that only one value in all rows is set to 1 and others are 0

There is a need to build constraint on the column that guarantees that only one value in all rows is 1 and all the others are 0. Solution with triggers exists but I would like to have something built in. Is such thing possible at all? ...

Converting ms access to mysql with relationships

I have tried some tools (such as mysql migration toolkit and bullzip's Access To MySQL utility.) that convert a ms access database to mysql which all successfully create the database, tables and insert the data. What they do not appear to do is recreate the relationships (constaints) from the original ms access database into mysql. Ar...