private string RemoveAliases(string sqlSelectString)
{
sqlSelectString = sqlSelectString.ToLower();
const string ALIAS_INDICATOR = " as ";
int aliasIndex;
int commaIndex;
string modifiedSqlString;
do
{
modifiedSqlString = sqlSelectString;
aliasIndex = sqlSelectString.IndexOf(ALIAS_INDICATOR, System.StringComparison.Ordinal);
if (aliasIndex != -1)
{
string columnTextExpressionAlias = sqlSelectString.Substring(aliasIndex);
commaIndex = columnTextExpressionAlias.IndexOf(",", System.StringComparison.Ordinal);
if (commaIndex != -1)
{
sqlSelectString = sqlSelectString.Remove(aliasIndex, commaIndex);
}
else
{
sqlSelectString = sqlSelectString.Remove(aliasIndex, columnTextExpressionAlias.Length);
}
}
}
while (sqlSelectString != modifiedSqlString);
return sqlSelectString;
}
Brak komentarzy:
Prześlij komentarz