473,414 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

smo and check constraints

How do you connect the check constraints on the Table object with the
columns in the table?

I ended up doing this and it smells bad.

foreach (Column cn in t.Columns)
{
foreach (Check ch in t.Checks)
{
if (ch.Text.Contains(cn.Name))
{
ct = typeof(bool);
break;
}
}
}

I couldn't find a Checks collection on the column or any other property
that might have show any check constraints.

Is there a better way for this?
Oct 25 '07 #1
1 3279
foreach (Constraint ch in t.Constraints)
{
if (ch.ConstraintName.Contains(cn.ColumnName))
{
ct = typeof(bool);
break;
}
}
use this ur problem is not clear

"Dan Holmes" wrote:
How do you connect the check constraints on the Table object with the
columns in the table?

I ended up doing this and it smells bad.

foreach (Column cn in t.Columns)
{
foreach (Check ch in t.Checks)
{
if (ch.Text.Contains(cn.Name))
{
ct = typeof(bool);
break;
}
}
}

I couldn't find a Checks collection on the column or any other property
that might have show any check constraints.

Is there a better way for this?
Oct 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Doug Baroter | last post by:
Hi, DDLs and DMLs: create table #job (jobID int identity(1,1) primary key, jobName varchar(25) unique not null, jobEndDate dateTime, jobComplete bit default(0), check (( is null and = 0) OR (...
3
by: RAD | last post by:
I am working with an evaluation copy of SQL Server 2000 for the first time; my DB experience lies with MS Access. I have a simple table in SQL Server (tblCompany) that has a field called...
0
by: Yuraukar | last post by:
I would like to check XML files with respect to identity constraints specified in the Schema (key, unique, keyref). Is there any free parser/tool that does this? I have worked with XML Spy 4.4, but...
2
by: ezra epstein | last post by:
Hi, I've got a table: <code language="SQL"> CREATE TABLE "common"."dynamic_enum" ( "pk_id" integer DEFAULT nextval('"common"."pw_seq"') , "enum_type" ...
9
by: Edmund Dengler | last post by:
Greetings! Just trying some tests out, and wanted to know about some optimizations. If I do a CHECK constraint on a table, is this used to optimize a SELECT or does Postgresql rely mostly on...
6
by: sarada7 | last post by:
How to check if DB Constraints are enabled in a database?
3
by: ferg | last post by:
I have a Customer table. The table has two different CHECK constraints. Then there is the Customer details dialog, which provides the user with an UI for changing users. I have some UPDATE sql,...
1
by: huyuhui | last post by:
The following is a question of LOAD utility. Question: How does the DB2 enforce table check constraints for data added to table with the LOAD utility? A. With the BUILD phase of LOAD B. With the...
1
by: PaulR | last post by:
Hi, (DB2 LUW 8.2) Is the DB2 optimiser able to use check constraints ? e.g table1 ( name varchar(30)
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.