当前位置:网站首页>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 13:59:00 【流苏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;
}
版权声明
本文为[流苏1990]所创,转载请带上原文链接,感谢
https://blog.csdn.net/fuweiping/article/details/82285225
边栏推荐
- Pytorch 经典卷积神经网络 LeNet
- 项目中遇到的问题(五)操作Excel接口Poi的理解
- Dynamic subset division problem
- Analysis of redo log generated by select command
- UNIX final exam summary -- for direct Department
- Use future and countdownlatch to realize multithreading to execute multiple asynchronous tasks, and return results after all tasks are completed
- Haruki Murakami -- Excerpt from "what do I talk about when I talk about running"
- Using Baidu Intelligent Cloud face detection interface to achieve photo quality detection
- STM32 learning record 0007 - new project (based on register version)
- cnpm的诡异bug
猜你喜欢

零拷貝技術
![MySQL [acid + isolation level + redo log + undo log]](/img/52/7e04aeeb881c8c000cc9de82032e97.png)
MySQL [acid + isolation level + redo log + undo log]

JS brain burning interview question reward

crontab定时任务输出产生大量邮件耗尽文件系统inode问题处理

Basic knowledge learning record

Elmo (bilstm-crf + Elmo) (conll-2003 named entity recognition NER)
![[VMware] address of VMware Tools](/img/0e/13f263bd69c8224f7c755258d94777.png)
[VMware] address of VMware Tools

Oracle告警日志alert.log和跟踪trace文件中文乱码显示

Taobao released the baby prompt "your consumer protection deposit is insufficient, and the expiration protection has been started"

Android 面试主题集合整理
随机推荐
Quartus prime hardware experimental development (de2-115 board) experiment II function adjustable comprehensive timer design
Small case of web login (including verification code login)
JUC interview questions about synchronized, ThreadLocal, thread pool and atomic atomic classes
Basic knowledge learning record
Yarn online dynamic resource tuning
Solution of discarding evaluate function in surprise Library
AtomicIntegerArray源码分析与感悟
Jiannanchun understood the word game
Haruki Murakami -- Excerpt from "what do I talk about when I talk about running"
freeCodeCamp----arithmetic_ Arranger exercise
Using Baidu Intelligent Cloud face detection interface to achieve photo quality detection
收藏博客贴
scikit-learn構建模型的萬能模板
Express middleware ③ (custom Middleware)
AttributeError: ‘dict‘ object has no attribute ‘iteritems‘
RAC environment alert log error drop transient type: systp2jw0acnaurdgu1sbqmbryw = = troubleshooting
[code analysis (1)] communication efficient learning of deep networks from decentralized data
MySQL [SQL performance analysis + SQL tuning]
Quartus prime hardware experimental development (de2-115 board) experiment 1 CPU instruction calculator design
Analysis of cluster component gpnp failed to start successfully in RAC environment