What is a method of determining if there is a default constraint on a column and its name, and the names of any indexes in order to drop them before dropping the column?
...
Hi all,
We currently have a table that looks like this:
ChildId | ParentID
------------------
1 | NULL
2 | NULL
3 | 1
4 | 3
Can anyone help me come up with a constraint/trigger that would prevent a circular reference from being inserted or updated into the table?
Thanks
...
Hello,
I am trying to memorize some sql syntax and I have gotten the ALTER TABLE ADD CONSTRAINT syntax down. I believe I am correct when I say that when you use this syntax to add a FOREIGN KEY or PRIMARY KEY constraint, that sql server automatically creates indexes to support the constraint operations. (Is that true...or is it only t...
ok please be gentle, I am new to WPF and LINQ - I have a strange problem here. I have a search screen and an add/edit screen. I have the add/edit screen bound to a 'CompanyContact' object and a search screen bound to a collection (CompanyContacts).
I have a 3 column unique constraint (FirstName, LastName, CompanyId) on the CompanyConta...
CREATE TABLE batsman
(
InningId int NOT NULL,
PlayerId int NOT NULL,
BatsmanOrder int(2) NOT NULL,
BatScore int NOT NULL default 0,
Balls int NOT NULL default 0,
sixes int NOT NULL default 0,
fours int NOT NULL default 0,
`out` varchar(10) NOT NULL, /*Foreign*/
catcher int, /*Foreign*/
bowler int, /*Foreign*/
Primar...
I am novice to joomla. I am using Joomla 1.5. I have declared a field in database table as unique. Lets suppose , I have declared "username" as unique . I created a component named "com_user" in the administrator/components section. Now, when I add a user "xyz123", for the first time, its ok. But, during next entry, when I enter the same...
Hi
Sorry for my shallow question .
Imagine I have 4 Tables in my DataBase (SQLServer 2005).
Picture , News , product and gallery Tables . At my Picture Table i Have 3 foreign key to all 3 other tables , And all foreign keys are nullable and default value = -1 . All tables have Primary keys and is Identity .
At my webform every ph...
I have the following code:
class Foo<T> where T : struct
{
private T t;
[...]
public bool Equals(T t) { return this.t == t; }
}
When I try to compile, it gives me the following error:
Operator '==' cannot be applied to operands of type 'T' and 'T'
Why can't it be done? If the constraint was where T : class it would h...
What is the best way to express range constraint in JPA? I would like to express something like 'this column can only take values between 1..5'.
Probably I could use @PrePersist and @PreUpdate for that.
Is there a better way?
...
Hi All
we are working on a users apllication using Access2003(VBA) as software language and SQL Server 2005 as database.
We are using ADO method and we encounter a problem.
when users create new record in a ADO Screen and they want to save the record after implementing it they receive this error :
error -2147217873 violation of primary ...
I'm having some trouble with a SQL Server 2005 database that seems like it's keeping a ghost constraint around. I've got a script that drops the constraint in question, does some work, and then re-adds the same constraint. Normally, it works fine. Now, however, it can't re-add the constraint because the database says that it already exis...
Hi,
I have a (simplified) table consisting of three columns:
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
foreignID INT NOT NULL,
name VARCHAR NOT NULL
Basically, I would like to add a constraint (at the database level rather than at the application level) where it only possible for one unique 'name' to exist per foreignID. For exampl...
For a normal index constraint, you can find the columns it is on by querying the all_ind_columns sysview using the index name in all_constraints. But if the constraint is disabled, no index exists, and there doesn't seem to be anywhere else that has constraint column information. How can I get the columns of a disabled index constraint f...
Hey,
I did not create the database I'm working with, but I would like to see the details of a check constraint.
I know a check constraint on a column is enforcing a set of specific values, and I'd like to know what those values are. For example, if a check constraint is enforcing the character 'Y' and 'N', I want to be able to query t...
I am using javax.validation.Validator and relevant classes for annotation based validation.
Configuration<?> configuration = Validation.byDefaultProvider().configure();
ValidatorFactory factory = configuration.buildValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<ValidatableObject>> const...
I have a USER table in database. The table has a RegistrationDate column which has a default constraint as GETDATE().
When using LINQ, I don't provide any data for RegistrationDate column to make it default. But SQL Server raises error. I think LINQ tries to insert NULL into the column.
How can I make LINQ not to try to insert in the c...
Alright, since a client wants to automate a certain process, which includes creating a new key structure in a LIVE database, I need to create relations between tables.columns.
Now I've found the tables ALL_CONS_COLS en USER_CONSTRAINTS to hold information about constraints. If I were to manually create constraints, by inserting into thes...
This jQuery lets you constrain drag movement so it occurs only on the axis specified:
$("#draggable2").draggable({ axis: 'x' });
See: http://jqueryui.com/demos/draggable/#constrain-movement
This is not legal jQuery but I wish it were:
$("#Container").resizable({ minHeight: 150, containment: {axis:'y' } });
Is it possible to preven...
I want to have an extension method for XElement/XAttribute that allows me to apply a "ValueOrDefault" logic - perhaps with various slightly different implementations: ValueOrNull, ValueOrDefault, NumericValueOrDefault (which validates if the value is numeric), but I want to constrain these methods so that they can only work with ValueTyp...
I meet a problem about type contraint of c# now.
I wrote a pair of methods that can convert object to string and convert string to object.
ex.
static string ConvertToString(Type type, object val) {
if (type == typeof(string)) return (string)val;
if (type == typeof(int)) return val.ToString();
if (type.IsSubclassOf(typeof(CodeObject)...