S
sjoshi
I need to check if a table in SQLServer 2005 is made up of one of the
LOB columns :image, ntext, text, varchar(max), nvarchar(max),
varbinary(max), and xml
Currently I'm using SMO with code like this...
private bool TableHasLOBColumns(ColumnCollection tableColns)
{
bool result = false;
foreach (Column cl in tableColns)
{
if (checkSQLTypes.Exists(delegate(SqlDataType match)
{
return match.Equals(cl.DataType.SqlDataType);
}))
{
result = true;
break;
}
} return result;
}
Where checkSQLTypes is defined as
private static List<SqlDataType> checkSQLTypes = new
List<SqlDataType>();
checkSQLTypes.AddRange(new SqlDataType[] { SqlDataType.Image,
SqlDataType.NText, SqlDataType.Text,
SqlDataType.NVarCharMax,
SqlDataType.VarCharMax, SqlDataType.VarBinaryMax, SqlDataType.Xml });
However I find the routine using SMO to be too slow especially when
one has 500+ tables to check. Is there a quicker/simpler way to do
this ??
thanks
Sunit
LOB columns :image, ntext, text, varchar(max), nvarchar(max),
varbinary(max), and xml
Currently I'm using SMO with code like this...
private bool TableHasLOBColumns(ColumnCollection tableColns)
{
bool result = false;
foreach (Column cl in tableColns)
{
if (checkSQLTypes.Exists(delegate(SqlDataType match)
{
return match.Equals(cl.DataType.SqlDataType);
}))
{
result = true;
break;
}
} return result;
}
Where checkSQLTypes is defined as
private static List<SqlDataType> checkSQLTypes = new
List<SqlDataType>();
checkSQLTypes.AddRange(new SqlDataType[] { SqlDataType.Image,
SqlDataType.NText, SqlDataType.Text,
SqlDataType.NVarCharMax,
SqlDataType.VarCharMax, SqlDataType.VarBinaryMax, SqlDataType.Xml });
However I find the routine using SMO to be too slow especially when
one has 500+ tables to check. Is there a quicker/simpler way to do
this ??
thanks
Sunit