TSQLStatementReader.ParseStatements throws Object reference not set to an instance of an object. exception
See original GitHub issueDiscussed in https://github.com/bruce-dunwiddie/tsql-parser/discussions/92
<div type='discussions-op-text'>Originally posted by muneeebsheikh June 3, 2022
I am trying to parse this select statement
SELECT system_user
but the method TSQLStatementReader.ParseStatements() throws
Object reference not set to an instance of an object.
stack trace
at TSQL.Elements.Parsers.TSQLSelectColumnParser.Parse(ITSQLTokenizer tokenizer)
at TSQL.Clauses.Parsers.TSQLSelectClauseParser.Parse(ITSQLTokenizer tokenizer)
at TSQL.Statements.Parsers.TSQLSelectStatementParser.Parse()
at TSQL.Statements.Parsers.TSQLSelectStatementParser.TSQL.Statements.Parsers.ITSQLStatementParser.Parse()
at TSQL.TSQLStatementReader.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at TSQL.TSQLStatementReader.ParseStatements(String tsqlText, Boolean useQuotedIdentifiers, Boolean includeWhitespace)
at Testing.App.SQLMethods.ParseSQLStatements(String sqlText) in D:\Testing.App\Testing.App\SQLMethods.cs:line 72
Kindly help me out if I am missing something or that’s the expected behavior. This is how I’m doing:
string sqlText = @"SELECT system_user;";
var statements = TSQLStatementReader.ParseStatements(sqlText);
I am using nuget package version: 2.1.0
interestingly if I change the select statement to this
SELECT system_user from tbl;
I just added a FROM clause and it works, it gives me the statement and tokens.
</div>Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
SQL Server 2012 error: object reference not set to an ...
I could solve the error. Repair the SQL Server. Go to Add/remove programs Microsoft SQL Server 2012(x64) -> Uninstall/Change -> Repair . Select ......
Read more >"Object reference not set to an instance of an ...
I have installed SSMS 18.10 and I have connected to Azure SQL Managed Instance, then trying to edit SQL Agent Job always failing...
Read more >Why doesn't "object reference not set to an instance of an ...
We're launching a system, and we sometimes get the famous exception NullReferenceException with the message Object reference not set to an ...
Read more >Object reference not set to an instance of an object
This article provides information on the error "Object reference not set to an instance of an object" in custom code.
Read more >Object reference not set to an instance of an object while ...
It simply means that some member/variable of some reference type is dereferences by using and of its instance (non-static) members, which ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bruce-dunwiddie thanks now its fixed!
@muneeebsheikh , I pushed a new build, v2.2.1, and verified the functionality is now updated with the version pulled back from NuGet.