Class SqlParser
Helper class for parsing sql statements
Inheritance
object
SqlParser
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: ETLBox.Helper
Assembly: ETLBox.dll
Syntax
public static class SqlParser
Methods
ParseColumnNames(string, string, string)
This method attempts to parse column names from any sql statement. E.g. SELECT 1 AS 'Test', Col2, t2.Col3 FROM table1 t1 INNER JOIN t2 ON t1.Id = t2.Id will return Test, Col2 and Col3 als column names.
Declaration
public static List<string> ParseColumnNames(string sql, string QB = "", string QE = "")
Parameters
Type | Name | Description |
---|---|---|
string | sql | The sql code from which the column names should be parsed |
string | QB | Optional: the start character used when quoting names (e.g. [ in SqlServer) |
string | QE | Optional: the end character used when quoting names (e.g. ] in SqlServer) |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<T><string> | The names of the columns in the sql |
ReplaceMatchWith(Match)
Declaration
public static string ReplaceMatchWith(Match match)
Parameters
Type | Name | Description |
---|---|---|
System.Text.RegularExpressions.Match | match |
Returns
Type | Description |
---|---|
string |