smo and check constraints

  • Thread starter Thread starter Dan Holmes
  • Start date Start date
D

Dan Holmes

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?
 
foreach (Constraint ch in t.Constraints)
{
if (ch.ConstraintName.Contains(cn.ColumnName))
{
ct = typeof(bool);
break;
}
}
use this ur problem is not clear
 
Back
Top