Menu

Home

Clay Lenhart

Basic TSQL Parser is a .Net DLL that you can use in your application to parse Streams, Readers or Strings into an enumeration of Tokens.

For example with the following C#/TSQL:

:::cs
SqlTokenReader.ReadTokens("DECLARE @var int;");

will give you the following objects (shown in JSON syntax):

\[
  {
    "OriginalString": "DECLARE",
    "TokenType": Word
  },
  {
    "OriginalString": " ",
    "TokenType": WhiteSpace
  },
  {
    "OriginalString": "@var",
    "TokenType": Word
  },
  {
    "OriginalString": " ",
    "TokenType": WhiteSpace
  },
  {
    "OriginalString": "int",
    "TokenType": Word
  },
  {
    "OriginalString": ";",
    "TokenType": PunctuationAndSymbols
  }
\]

Project Members: