# MS SQL keyword LineNo errors

**URL:** <https://forum.inductiveautomation.com/t/ms-sql-keyword-lineno-errors/76800>\
**Category:** General Discussion\
**Created:** [July 24, 2023, 5:21pm UTC](https://forum.inductiveautomation.com/t/ms-sql-keyword-lineno-errors/76800 "2023-07-24T17:21:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [July 24, 2023, 5:21pm UTC](https://forum.inductiveautomation.com/t/ms-sql-keyword-lineno-errors/76800/1 "2023-07-24T17:21:18Z")

</div>

I set a column as LineNo and I get errors it is a keyword.

I can't find any actual documentation of this. I just see a ton of people asking the same question and a lot of speculation.

Anyone know where I can get documentation on what is going on with MS SQL and 'LineNo' keyword?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 24, 2023, 5:29pm UTC](https://forum.inductiveautomation.com/t/ms-sql-keyword-lineno-errors/76800/2 "2023-07-24T17:29:00Z")

</div>

> **[Reserved Keywords (Transact-SQL) - SQL Server](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql?view=sql-server-ver16)**
>
> Reserved Keywords (Transact-SQL)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 24, 2023, 5:52pm UTC](https://forum.inductiveautomation.com/t/ms-sql-keyword-lineno-errors/76800/3 "2023-07-24T17:52:42Z")

</div>

🤷‍♂️  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/e/8ec73e74ee5a09befe4a4984874dbf255c23aa79.png)

I suspect it was to provide some functionality similar to FoxPro, when it existed and Microsoft bought them out. But, in typical Microsoft fashion, never did anything with it outside of internal use.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 24, 2023, 6:42pm UTC](https://forum.inductiveautomation.com/t/ms-sql-keyword-lineno-errors/76800/4 "2023-07-24T18:42:01Z")

</div>

It's reserved. If you've ever troubleshot a SQL Server Stored Procedure, you may have learned to do `LINENO 0` after your begin statement to reset the line count otherwise it can be impossible to find where there error is given the line number sql server will give you otherwise.

I would just use `LineNumber` or `LineNum`.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [July 24, 2023, 9:03pm UTC](https://forum.inductiveautomation.com/t/ms-sql-keyword-lineno-errors/76800/5 "2023-07-24T21:03:35Z")

</div>

Do you mean that is one of the designed uses of that keyword?

Or it is like a handy trick that happens to work?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 25, 2023, 12:08pm UTC](https://forum.inductiveautomation.com/t/ms-sql-keyword-lineno-errors/76800/6 "2023-07-25T12:08:12Z")

</div>

Believe it's the intended purpose - to reset the line number to whatever you want and that is where the error code then counts off from for SQL Server. Otherwise the line number you get from an error code in a stored procedure that has an error, if you have a lot of dynamic sql spread over many line that often gets turned into 1 line, and so the line number is not very helpful. It's a useful debugging tool - I don't know what other purpose it may serve. Take a look here - [sql server - What exactly does the T-SQL "LineNo" reserved word do? - Stack Overflow](https://stackoverflow.com/questions/4054511/what-exactly-does-the-t-sql-lineno-reserved-word-do)

I still wouldn't do it but it seems like you can still use it as long as you do your statements like `SELECT [LineNo]` according to a lower down answer.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [July 25, 2023, 12:23pm UTC](https://forum.inductiveautomation.com/t/ms-sql-keyword-lineno-errors/76800/7 "2023-07-25T12:23:56Z")

</div>

Thanks guys
