Class SqlParser
Helper class for parsing sql statements
Inherited Members
Namespace: ETLBox.Helper
Assembly: ETLBox.dll
Syntax
public static class SqlParserMethods
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 |
|---|---|
| List<string> | The names of the columns in the sql |
ReplaceMatchWith(Match)
Declaration
public static string ReplaceMatchWith(Match match)Parameters
| Type | Name | Description |
|---|---|---|
| Match | match |
Returns
| Type | Description |
|---|---|
| string |