当前位置:网站首页>SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
2022-04-23 16:51:00 【Tassel 1990】
public static TSqlScript Convert(string sql, out string prettySql)
{
var hasQuotedIdentifiers = false;
var parser = new TSql100Parser(hasQuotedIdentifiers);
var options = new SqlScriptGeneratorOptions();
options.SqlVersion = SqlVersion.Sql100;
options.KeywordCasing = KeywordCasing.Uppercase;
options.MultilineSelectElementsList = true;
options.MultilineWherePredicatesList = true;
IScriptFragment fragment;
IList<ParseError> errors;
using (var sr = new StringReader(sql))
{
fragment = parser.Parse(sr, out errors);
}
if (errors != null && errors.Count > 0)
{
var errorMessage = new StringBuilder();
foreach (var error in errors)
{
errorMessage.Append(error.Message);
errorMessage.Append("offset " + error.Offset);
}
throw new ApplicationException(errorMessage.ToString());
}
new Sql100ScriptGenerator(options).GenerateScript(fragment, out prettySql);
var parsedSql = fragment as TSqlScript;
return parsedSql;
}
版权声明
本文为[Tassel 1990]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231359254009.html
边栏推荐
- ∑GL-透视投影矩阵的推导
- STM32__ 03 - beginner timer
- Esxi encapsulated network card driver
- 伪分布安装spark
- Loggie source code analysis source file module backbone analysis
- Public variables of robotframework
- Talk about browser cache control
- File system read and write performance test practice
- org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
- DanceNN:字节自研千亿级规模文件元数据存储系统概述
猜你喜欢

Change the password after installing MySQL in Linux

Use case execution of robot framework
Xinwangda: HEV and Bev super fast charging fist products are shipped on a large scale

NVIDIA graphics card driver error

How magical is the unsafe class used by all major frameworks?

Gartner announces emerging technology research: insight into the meta universe
![[pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return](/img/f5/15b3731e75eb4d861bd9d29ae244da.png)
[pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return

Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100

详解牛客----手套

Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin
随机推荐
Encapsulating the logging module
NVIDIA graphics card driver error
Gartner 發布新興技術研究:深入洞悉元宇宙
Gartner 发布新兴技术研究:深入洞悉元宇宙
Set cell filling and ranking method according to the size of the value in the soft report
UWA Pipeline 功能详解|可视化配置自动测试
正则过滤内网地址和网段
MySQL restores data through binlog file
Path environment variable
ByteVCharts可视化图表库,你想要的我都有
org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
Pseudo Distributed installation spark
如何用Redis实现分布式锁?
Execution plan calculation for different time types
OMNeT学习之新建工程
STM32__03—初识定时器
信息摘要、数字签名、数字证书、对称加密与非对称加密详解
Quick install mongodb
Camtasia2022软件新增功能介绍
How to build tiktok user trust and drive fan growth