constraints

Drop All constraints in a Table

回眸只為那壹抹淺笑 提交于 2019-11-28 18:23:32
Am trying to write script for removing Constraints. I have the below function to select the Constarints in my DataBase SELECT name FROM sys.foreign_keys And I have written alter scripts using the above scripts SELECT 'ALTER TABLE ' + OBJECT_NAME(parent_object_id) + ' DROP CONSTRAINT ' + name FROM sys.foreign_keys Using the above query how can I execute these constraints ? I can use DROP DATABASE DBName . But am just trying to drop tables by dropping Constraints. is it possible without going for SP ? Or any easy ways I can proceed? Well you can always copy the output from the bottom pane, paste

How to disable Constraints for all the tables and enable it?

被刻印的时光 ゝ 提交于 2019-11-28 17:52:14
I have 60 tables. I want to drop 10 tables where these 10 tables are Constraints(PK,FK) to other 20 tables. While dropping these 10 tables, I need to truncate or delete data from the other 20 tables. Finally I want to disable all 60 table Constraints(FK,PK) and then enable all 60 table constraints after I am done with my work of adding/dropping tables. Is this possible? When I drop a table it is asking for FK. When I truncate those FK dependencies it also is still showing the same. I don't want to mess with all those FK,PK. I want to know smarter method. Stefan Steiger EXEC sp_MSforeachtable

How do you drop a default value or similar constraint in T-SQL?

微笑、不失礼 提交于 2019-11-28 17:42:41
I know the syntax: ALTER TABLE [TheTable] DROP CONSTRAINT [TheDefaultConstraint] but how to I drop the default constraint when I don't know its name? (That is, it was autogenerated at CREATE TABLE time.) If you want to do this manually, you can use Management Studio to find it (under the Constraints node inside the table). To do it using SQL: If the constraints are default constraints, you can use sys.default_constraints to find it: SELECT OBJECT_NAME(parent_object_id) AS TableName, name AS ConstraintName FROM sys.default_constraints ORDER BY TableName, ConstraintName If you are looking for

How to create a custom UITableViewCell programmatically using AutoLayout

China☆狼群 提交于 2019-11-28 16:13:33
I'm trying to implement a UITableView that will behave similarly to the timeline of a twitter client. Right now I'm simply attempting to get two labels inside a UITableViewCell. As recommended by this Stack Overflow answer , I'm using a different reuseIdentifier for each layouts. My layouts are simple, consisting of either a single label or two labels. Eventually I will be adjusting the height of the UITableViewCells but first I need to get the cells populated with content. I can get the labels so show up if I set their frame with initWithFrame: , however the constraints aren't being

MySQL terminology “constraints” vs “foreign keys” difference?

谁说胖子不能爱 提交于 2019-11-28 16:11:58
I'm looking at the MySQL docs here and trying to sort out the distinction between FOREIGN KEYs and CONSTRAINTs. I thought an FK was a constraint, but the docs seem to talk about them like they're separate things. The syntax for creating an FK is (in part)... [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name, ...) REFERENCES tbl_name (index_col_name,...) So the "CONSTRAINT" clause is optional. Why would you include it or not include it? If you leave it out does MySQL create a foreign key but not a constraint? Or is it more like a "CONSTRAINT" is nothing more than a name for you FK,

How can I change constraints priority in run time

为君一笑 提交于 2019-11-28 15:55:09
问题 I have a view which has dynamic height and I am trying to change this view height priority in run time. Here is my part of code; if (index == 0) { surveyViewHeightConstraint.constant = 0; surveyViewHeightConstraint.priority = 1000; } else if (index == 1) { surveyViewHeightConstraint.constant = 163; surveyViewHeightConstraint.priority = 500; } I am changing index with a button action. When I run this code, I am getting this error: *** Assertion failure in -[NSLayoutConstraint setPriority:],

Auto Layout to dynamically size uilabel width

风格不统一 提交于 2019-11-28 15:52:19
So I have two UILabels side by side in Storyboard. The second label should butt up against the right edge of the first one (trailing constraint of 1), but I also need the first label (the one on the left) to set it's width equal to it's content size unless it hits a max width. Visually: |Label one text| |Label two text| And I need the following constraints: 1) Label one should resize width wise unless it hits a max size. 2) Label two should always be butted up against the right edge of label one How do I set this up in Storyboard? Create the 1 point horizontal space between the labels: Control

Auto Layout (Constraints) Center 2 side by side views in a parent view

前提是你 提交于 2019-11-28 15:27:36
I'm trying to figure out how to do this with auto layout (iOS6) and constraints. Basically I have my large view divided up into two sections on the bottom. Inside of those sections (currently subviews) I have an image view and a label. I want to center those on both sides, with variable length text. My head is mostly wrapped around auto layout, but I'm not sure the best approach to this. I'm inclined to think it's not possible in IB, but is in code. Going to continue trying to figure this out, but in the meantime here is the example I'm trying to create. John Sauer Is this what you're after? I

List of Constraints from MySQL Database

馋奶兔 提交于 2019-11-28 15:20:32
How do I get a list of all constraints from a particular database? Use the information_schema.table_constraints table to get the names of the constraints defined on each table: select * from information_schema.table_constraints where constraint_schema = 'YOUR_DB' Use the information_schema.key_column_usage table to get the fields in each one of those constraints: select * from information_schema.key_column_usage where constraint_schema = 'YOUR_DB' If instead you are talking about foreign key constraints, use information_schema.referential_constraints : select * from information_schema

Remove all constraints affecting a UIView

牧云@^-^@ 提交于 2019-11-28 15:08:32
问题 I have a UIView which is placed on the screen via several constraints. Some of the constraints are owned by the superview, others are owned by other ancestors (e.g. perhaps the view property of a UIViewController). I want to remove all of these old constraints, and place it somewhere new using new constraints. How can I do this without creating an IBOutlet for every single constraint and having to remember which view owns said constraint? To elaborate, the naive approach would be to create a