Cannot access property XmlSchemaNamespace

After assigning a default value to the DefaultConstraint.Text property, I get the following error: Cannot access property XmlSchemaNamespace.This property is not available on SQL Server 2000. I am going against a SQL server 2000, but I am only assigning a default value to an existing column and don't think I should be getting any errors.

Any ideas?
Thanks,

[409 byte] By [sschleicher] at [2008-2-5]
# 1
Hi, take a look at http://blogs.msdn.com/mwories/articles/smosample_default_constraint.aspx. This is a sample that indicates how to use DefaultConstraint. If you still have problems after reading this and modifying your code, then please post a small working code snippet that explains your problem, so I can take a look.

Thanks,

MichielWories at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server SMO/DMO...
# 2
That sample worked great and I got it from you previous post. I am running across an issue when creating a constraint for an existing column. I have attached a code sample. Thanks again.



With table.Columns.Item("myColumnName")
If delta.sourceColumn.DefaultValue = "" Then
.DefaultConstraint.Drop()
Else
If .DefaultConstraint Is Nothing Then
.AddDefaultConstraint("DF_" & Guid.NewGuid.ToString)
End if
.DefaultConstraint.Text = delta.sourceColumn.DefaultValue
End if
End With

sschleicher at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server SMO/DMO...
# 3

after I add a Default and then bind it to a column, it generats this exception.

what's wrong with it? I add constraints code(in your link above), it doesn't help.

any tips?

tangy at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server SMO/DMO...
# 4

Hey mate, have you reslove this problem?

tangy at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server SMO/DMO...

SQL Server

Site Classified